Post

There's actual gamut mapping of wide-gamut colors in Firefox Nightly- I'm going to play around with it a bit and see how it's working. It's in Firefox Nightly 153, by setting layout.css.gamut-mapping.method to 2.

3 reposts7 likes

CSS Color 4 specifies 3 algorithms that can be used, and Firefox implemented Binary Search (in the gradients tool as "CSS") and Ray Trace. I'm testing out Ray Trace, which is a bit faster yet not as precise.

For comparison, here is the current state of Firefox - note how it matches the Clip gradient, where values outside of the gamut (I forget which one, is it rec2020? P3? The display?) are just clipped, which skews the colors to be much more saturated.

Now things are getting interesting. It looks like the color `oklch(90% .1 20)` is getting rendered by Firefox much more lavender than expected, and doesn't match the ColorJS implementation. Note the final step here is inside rec2020, while everything else is outside, which may be why.