New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CSS variables (custom properties) #6
Comments
How to deal with browsers that don't implement it yet? |
there's always the sass/less files if someone wants to use variables. |
+1 kinda. i was hoping this repo was literally just a :root {
var-aqua: #7FDBFF;
var-blue: #0074D9;
...
} and that's it. then we could just use them wherever we want in css without having to add classes to things. and if you wanted browser support you could use rework or myth and you could expose the same thing in sass/less variables if you wanted too. not having the pre-definied classes is a bonus imo. let me know if you don't want this change, i'll make a separate repo with just simple color definitions |
You can always make a separate branch that can be developed independently and merged later when CSS variables has more support, right now I think no browser supports it without enabling a flag/lab/experiment. |
Thanks for flagging this @iamvdo, I've added a separate source folder that allows for css variable usage and compilation with myth via a gulp task. @ianstormtaylor - appreciate the sentiment but the predefined classes are a big part of why I put this together. I find I'm able to prototype much more quickly when I only have to do work in html. Tacking classes on things doesn't seem that hard to me. Plus, single purpose classes have the added benefit of rendering very quickly, thus improving performance in both css download time and page rendering time. So, seems like a win win to me for the problems I am trying to solve. It's obviously a crazy small code base so if they truly are a bane to people - I think they are pretty easy to either not use, or just delete. |
Since CSS variables have gained a lot of support in the meantime, please consider adding them to colors.css. * {
--navy: #001F3F;
--blue: #0074D9;
--aqua: #7FDBFF;
--teal: #39CCCC;
--olive: #3D9970;
--green: #2ECC40;
--lime: #01FF70;
--yellow: #FFDC00;
--orange: #FF851B;
--red: #FF4136;
--fuchsia: #F012BE;
--purple: #B10DC9;
--maroon: #85144B;
--white: #FFFFFF;
--silver: #DDDDDD;
--gray: #AAAAAA;
--black: #111111;
} |
CSS Custom Properties / Variables are all but supported, excepting IE11. My guess is that many of the use cases for this repo are just putting code pens together so the colors aren't screaming at you, and not really sending to production (or if you are, putting in the appropriate pre-processors into your build steps). Not sure how the changes would exist alongside the class definitions, but this was definitely my intended use when looking at the project |
Hey,
Instead of using classes, it will be better to use CSS variables, like so:
Maybe it will be cool to add for progressive enhancement ?
The text was updated successfully, but these errors were encountered: