Re: [csswg-drafts] [css-color-4] Gamut Mapping with Oklch - Odd Results (#7071)

To corroborate some results, here's what I noticed [in my demo](https://danburzo.ro/demos/color/gamut-mapping.html), if you try to gamut map CIELCH in OKLCH (that is, _Illustrate space: LCH D50_, _Mapping space: OKLCH_), even with simple chroma reduction.

Shifts in hue:
<img width="236" alt="Screenshot 2022-03-28 at 21 47 55" src="https://user-images.githubusercontent.com/205375/160466048-5a94599c-7059-438c-9efb-0689ecaf8f91.png">

And this bothersome band in the blues:

<img width="211" alt="Screenshot 2022-03-28 at 21 47 47" src="https://user-images.githubusercontent.com/205375/160466099-026cc0fe-acf7-44a5-8923-247d0454f7ba.png">

These two effects make it sound like there's some sort of clipping going on in the conversion process?  The plots use [culori.js](https://culorijs.org/), so I'm not excluding implementation errors, and in my particular implementation clipping CIELCH in OKLCH involves the following conversion chain: cielch -> cielab -> xyz d50 -> xyz d65 -> lrgb -> rgb -> lrgb -> xyz d65 -> oklab -> oklch -> (chroma reduction) and back, so there are several moving pieces.

I'll try a demo that doesn't go through RGB at all to exclude anything regrettable going on with the RGB encoding/decoding functions.

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


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

Received on Monday, 28 March 2022 18:57:52 UTC