[csswg-drafts] [css-color] Computing lch/lab to srgb with lightness = 0% or 100% (#8794)

yiyix has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color] Computing lch/lab to srgb with lightness = 0% or 100% ==
According to the [spec](https://drafts.csswg.org/css-color-4/#specifying-lab-lch), "The first argument specifies the CIE Lightness, L. This is a number between 0% or 0 (representing black) and 100% or 100 (representing white), Values less than 0% or 0 must be clamped to 0% at parsed-value time; values greater than 100% or 100 are clamped to 100% at parsed-value time"

With the current color conversion algorithm, both Chrome and Safari are still using a and b (or c and h) when lightness is at 0% or 100%. example: https://jsfiddle.net/orah1qd2/ lab(0, 100, 100) is showing as some shade of red instead of black. 

I am trying to understand how the color conversion works for lightness at 0% or 100%. 

- Does it follow the current conversion algorithm and convert to White/Black when lightness is at 0% or 100%? The issue is it will not create a nice color spectrum and users might be surprised to see this when the color doesn't change with a and b (or c and h) for l at 0 (or 100).
- Or our current color conversion algorithm is wrong, and we should rewrite and convert to black and white smoothly as lightness hit 0% or 100%? I think the issue here is that color spectrum would look very different.   

Thank you for helping.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8794 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 4 May 2023 19:40:50 UTC