question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support CSS Color Level 4 hwb/lab/lch/gray functions (and related adjustments)

See original GitHub issue

Implementation

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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:22 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
mirisuzannecommented, Mar 12, 2020

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 using hsl() or rgb() 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.

2reactions
mirisuzannecommented, Mar 13, 2020

I’m told by the editors of CSS Color level 4 that the best solution is to lock hue & lightness, then reduce chroma until the color is in-gamut.

I’ve created a (rough, slow) demo of that approach.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found