Support CSS Color Level 4 hwb/lab/lch/gray functions (and related adjustments)
See original GitHub issue- Proposal (Language)
- Proposal (JS API)
- Embedded Protocol
- Request for Comments (https://github.com/sass/sass-site/pull/671)
Implementation
- Dart Sass
- Node.js Embedded Host
- Tests
- Documentation
- Specification
- Migrator
Breaking Changes
See Color Level 4
Having access to CIE colors/adjustments would be particularly useful for design systems, and it seems like we could provide the syntax in sass:color
without waiting on browsers to support the CSS variant.
When I say adjustments, I’m not referring to the new CSS color functions in Level 5. I think we need to wait for those to solidify. I’m thinking of something similar to, or extending, color.adjust()
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:22 (17 by maintainers)
Top Results From Across the Web
Support CSS Color Level 4 hwb/lab/lch/gray functions (and related ...
Support CSS Color Level 4 hwb/lab/lch/gray functions (and related adjustments ) ... Having access to CIE colors/adjustments would be particularly useful for design ......
Read more >CSS Color Module Level 4 - W3C
CSS has several syntaxes for specifying color values: the sRGB hex color notation which represents the RGB and alpha channels in hexadecimal ...
Read more ><color> - CSS: Cascading Style Sheets - MDN Web Docs
Similar to HSL color model, the HWB color model defines a given color in ... list are defined by the CSS Color Module...
Read more >A Guide To Modern CSS Colors With RGB, HSL, HWB, LAB ...
The CSS Color Module Level 4 provides us with a more convenient syntax for our color functions, which is widely supported in browsers....
Read more >"color" | Can I use... Support tables for HTML5, CSS3, etc
#rrggbbaa hex color notation · Color input type · CSS color() function · CSS3 Colors · LCH and Lab color values · Rebeccapurple...
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
Yeah, I think we should not be adding these to the global namespace. But if we put them in the
sass:color
module, they can provide both consistent sRGB output, and a straight-forward optional upgrade path. Authors can start using the plain CSS functions on their own schedule, without our intervention, and the module functions will continue to be useful for supporting old browsers.I’m thinking of them like the
sass:math
functions that overlap CSS – a bit more limited than what the eventual CSS functions will provide, but a consistent and backwards-compatible pre-compiled option. No config required, and no more per-screen variation than usinghsl()
orrgb()
now.While there are several methods for handling out-of-gamut colors, it’s clear (and defined in the CSS spec) that we should be using “relative-colorimetric” rendering. That doesn’t leave much that we need to decide. At this point, I think if we can find a good method for calculating relative-colorimetric adjustments, I can finish putting together a proposal.
I’m told by the editors of CSS Color level 4 that the best solution is to lock
hue
&lightness
, then reducechroma
until the color is in-gamut.I’ve created a (rough, slow) demo of that approach.