Re: [csswg-drafts] [css-color-4] How to handle conversions that result in negative lightness? (#9484)

Related:

 - https://github.com/w3c/csswg-drafts/issues/9222
 
 `hsl()` has a parse-time clamp of negative saturation, when using legacy syntax. The above issue is about what to do with `hsl()` modern syntax, at parse time, where there is no interop.
 
 For `rgb()` there is parse-time clamping in legacy syntax and in modern syntax, because of historical backlog (same with the 0 to 255 range) while `color()` does not, because it does not have that web-compat burden.

> At the same time, the sample conversion algorithms explicitly say that they expects the saturation and lightness to be "in reference range `[0,100]`" and the red, green, and blue components to be in `0..1`

The reference range is used for converting percentage values to numbers. It does not imply that values outside that range are invalid.

> (For what it's worth I believe the RGB/HSL conversion algorithms do work as written to round-trip out-of-gamut colors, although the HWB algorithms do not.)

I agree, they do.

> For what it's worth, my preference would be _not_ to clamp `rgb()`, or `lab()` for that matter, at parse-time so that the simple representation of out-of-gamut RGB colors works the same way as out-of-gamut `color()` values.)

If `rgb()` was just now being deployed, that would be preferable but we have Web compat to consider. Which brings us to `lab() and friends. The CIE ones (for compatibility with industry practice, again) use a D50 white point and thus, very dark colors with unrealistically high chroma will tend to become negative on one side of the neutral axis because chromatic adaptation is effectively tilting that axis.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9484#issuecomment-1936230760 using your GitHub account


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

Received on Friday, 9 February 2024 16:30:36 UTC