Using CSS for Chart.js colors
See original GitHub issueThis is not an issue as such, but it might be useful to someone else out there…
I’ve developed a simple library that uses Sass to create default CSS color formats for Chart.js and a javascript/jQuery function that will assign those colors to the data
object.
This removes colors from being baked into the javascript and puts them back in the CSS for designers to manage.
Please feel free to use it: https://github.com/mcldev/ChartJS-Sass/
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Using CSS variables (color) with chart.js - "var - Stack Overflow
I've got a web-app project that uses two stylesheets to define two color sets (day & night ...
Read more >Colors | Chart.js
Colors. Charts support three color options: for geometric elements, you can change background and border colors;; for textual elements, ...
Read more >Support css variables for colors #9983 - chartjs/Chart.js - GitHub
I'm trying to keep my charts always styled with the correct color. This depends on dark/light style and is a hassle to have...
Read more >CSS variable colors on Chart.js - CodePen
Use colors from CSS variables to theme Chart.js line charts...
Read more >How to Color the Indicator With CSS in Chart JS | Part 2
How to Color the Indicator With CSS in Chart JS | Part 2In this video we will explore how to color the indicator...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, simplified the pen quite a lot: https://codepen.io/kurkle/pen/KKpaYwx So it can be done (not exactly as you wrote though). Browser support: https://caniuse.com/#feat=css-variables
@CookiesGirl you could use css-vars: https://codepen.io/kurkle/pen/JjoXXXv