Re: [csswg-drafts] [css-color-4] Clarify that `none` is preserved in calculations (#10211)

There is another scenario in which color space conversion happens.

`hsl`, `rgb`, `hwb` serialize as `color(srgb ...)` to aid in preserving wide gamut colors.

For example :
`rgb(from rgb(250 120 120) calc(r + 20) g b)`
if serialized as `rgb(270 120 120)` it would be clamped when roundtripping
To prevent that, it serialized as `color(srgb 1.05882 0.470588 0.470588)` instead

Chrome has implemented this and you can see how it erases `none` : https://codepen.io/romainmenke/pen/VwNRBgg?editors=1111

I would have expected them to only do this conversion to `color(srgb ...)` when absolutely needed, but seems to happen quite eagerly.

Compared to something like `lch` which doesn't have the same legacy and back-compat concerns and therefore lacks this serialization : https://codepen.io/romainmenke/pen/dyLrgdv?editors=1111

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


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

Received on Friday, 26 April 2024 21:34:17 UTC