Re: [csswg-drafts] [css-color-4] Allow out-of-gamut HSL/HWB colors (previously "Move gamut mapping to a future spec") (#8444)

> Options:
> 1. Use gamut mapping as tested in WPT
> 2. Use clip (the wording "are clamped" comes from at least CSS Color 3; CSS 2.2 is silent but has [an example showing clipping](https://www.w3.org/TR/CSS22/syndata.html#color-units))
> 3. See if unbounded rgb() would be acceptable (we already went from integer to number on rgb())
> 4. Disallow RCS with rgb() and have people use color(srgb) instead which has no gamut limitation, being defined on the full range

Options 2) or 4) both seam reasonable, with 4) being ideal. Instead of disabling relative color syntax (or color-mix) for that matter with legacy rgb, we could just return with the `color(srgb` syntax, which I think fits the general design pattern of "CSS Color 4/5 functions use non-legacy color types, when possible." Like how `oklab` is the default gradient interpolation space.

Given that display-p3 green in sRGB is `color(srgb -0.511814 1.01832 -0.310726)`, we'd have the following computed styles:
`rgb(from color(display-p3 0 1 0) r g b / alpha)` --> `color(srgb -0.511814 1.01832 -0.310726)`
`color-mix(in hsl, color(display-p3 0 1 0) 100%, black)` --> `color(srgb -0.511814 1.01832 -0.310726)`

If both `color-mix` and `from color` always returned non-legacy colors (`color(srgb` for `rgb`, `hsl`, `hwb`) that would very cleanly solve our issues in a straightforward and unsurprising way. You are correct that unbounded legacy rgb is a break with history and would surely cause some backwards compatibility issues.

> @tabatkins @weinig @GPHemsley could you review https://github.com/web-platform-tests/wpt/pull/39451 please?

LGTM! 


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


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

Received on Thursday, 20 April 2023 19:52:20 UTC