Re: [csswg-drafts] [css-color-4] Channel clipping breaks author expectations, especially when using 'perceptually uniform' spaces (#9449)

The results are different, but they don't look bad doing gradients. I implemented the Scale LH to work with all the current CSS gamuts in a test environment. This [example](https://facelessuser.github.io/coloraide/playground/?source=https%3A%2F%2Fgist.githubusercontent.com%2Ffacelessuser%2F28c1eaa08cef0f0172866d09b698b611%2Fraw%2F4ef088e2ce98a50510d123b029ca7d0282c4052a%2Foklch-scale.py) should display the colors in sRGB or Display P3 depending on what it can detect is supported.

<img width="1390" alt="Screenshot 2024-02-14 at 9 36 56 AM" src="https://github.com/w3c/csswg-drafts/assets/1055125/1dddf5ea-7e43-4c6f-9c21-afb5d253bab3">

The scale approach does not hold lightness quite as steady, but I'm not sure that is a problem if the results seem good enough.

![oklch-chroma](https://github.com/w3c/csswg-drafts/assets/1055125/1738a5ed-2801-40cb-b3bc-8a9800195209)
![oklch-scale](https://github.com/w3c/csswg-drafts/assets/1055125/512c89a2-bc37-43ab-93c1-01ee023c4fde)

I think it is interesting to compare results in a more complex case. Here we take an image and multiply the chroma by 3 up to push a lot of the colors out of gamut and then apply the original CSS gamut mapping algorithm and the scale LH.

Original:

![flowers](https://github.com/w3c/csswg-drafts/assets/1055125/46e984f4-4b6f-4016-ba87-b483766707c0)

CSS MINDE Chroma reduction

![flowers-map](https://github.com/w3c/csswg-drafts/assets/1055125/cd86c6b6-cd0c-4048-a4db-a441c2ad41fd)

Scale LH

![flowers-scale](https://github.com/w3c/csswg-drafts/assets/1055125/8f18dc44-1650-4b0e-a519-83cccf611f6c)











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


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

Received on Wednesday, 14 February 2024 16:56:06 UTC