Re: [csswg-drafts] [css-color-4] gather use cases and examples for gamut mapping (#9966)

I think when it comes to tones and OkLCh, the problem is more the scaling of lightness in OkLCh, not the reducing of chroma. I also don't think the result for 90% lightness using the CSS GMA method is actually a bad result. In the example below, we will try to create tones by just changing lightness and using the CSS GMA.

The first example uses CSS GMA with OkLCh as is. The results are okay, but with the way lightness is scaled, dark tones are hard to distinguish. But when we adust our lightness scale to to be closer to CIE Lab (D65), we get reasonable, predictable tones. Tones at 90% are pretty comparable in both cases.

[Example here](https://facelessuser.github.io/coloraide/playground/?code=K_1%20%3D%200%2e206%0AK_2%20%3D%200%2e03%0AK_3%20%3D%20%281%2e0%20%2B%20K_1%29%20%2F%20%281%2e0%20%2B%20K_2%29%0A%0Adef%20toe_inv%28x%3A%20float%29%20-%3E%20float%3A%0A%20%20%20%20%22%22%22Inverse%20toe%20function%20for%20L_r%2e%22%22%22%0A%0A%20%20%20%20return%20%28x%20%2a%2a%202%20%2B%20K_1%20%2a%20x%29%20%2F%20%28K_3%20%2a%20%28x%20%2B%20K_2%29%29%0A%0Adef%20good_oklch_tonal_palette%28c%29%3A%0A%20%20%20%20%22%22%22OkLCh%20tonal%20palettes%2e%22%22%22%0A%0A%20%20%20%20c%20%3D%20Color%28c%29%2econvert%28%27oklch%27%29%0A%20%20%20%20tones%20%3D%20%5B0%2C%2010%2C%2020%2C%2030%2C%2040%2C%2050%2C%2060%2C%2070%2C%2080%2C%2090%2C%2095%2C%20100%5D%0A%20%20%20%20return%20%5Bc%2eclone%28%29%2eset%28%27l%27%2C%20toe_inv%28tone%20%2F%20100%29%29%2efit%28%27srgb%27%2C%20method%3D%27oklch-chroma%27%29%20for%20tone%20in%20tones%5D%0A%0Adef%20bad_oklch_tonal_palette%28c%29%3A%0A%20%20%20%20%22%22%22OkLCh%20tonal%20palettes%20with%20no%20lightness%20corrections%2e%22%22%22%0A%20%20%20%20c%20%3D%20Color%28c%29%2econvert%28%27oklch%27%29%0A%20%20%20%20tones%20%3D%20%5B0%2C%2010%2C%2020%2C%2030%2C%2040%2C%2050%2C%2060%2C%2070%2C%2080%2C%2090%2C%2095%2C%20100%5D%0A%20%20%20%20return%20%5Bc%2eclone%28%29%2eset%28%27l%27%2C%20tone%20%2F%20100%29%2efit%28%27srgb%27%2C%20method%3D%27oklch-chroma%27%29%20for%20tone%20in%20tones%5D%0A%0ASteps%28%5BColor%28%27lch-d65%27%2C%20%5Btone%2C%200%2C%20NaN%5D%29%20for%20tone%20in%20%5B0%2C%2010%2C%2020%2C%2030%2C%2040%2C%2050%2C%2060%2C%2070%2C%2080%2C%2090%2C%2095%2C%20100%5D%5D%29%0ASteps%28good_oklch_tonal_palette%28%27gray%27%29%29%0ASteps%28bad_oklch_tonal_palette%28%27red%27%29%29%0ASteps%28good_oklch_tonal_palette%28%27red%27%29%29).

<img width="1373" alt="Screenshot 2024-02-17 at 1 27 24 AM" src="https://github.com/w3c/csswg-drafts/assets/1055125/44dfe742-a58c-4d94-ba7c-a3ff2bf88067">

Let's compare Scale LH and vs the CSS GMA + some lightness scaling. [Example] (https://facelessuser.github.io/coloraide/playground/?source=https%3A%2F%2Fgist.githubusercontent.com%2Ffacelessuser%2F9ed4c9b719404e8ae338484c92fc1f7a%2Fraw%2F06b524024678a0c33c88c707da8d8b2925022f6b%2Fscalelh.py). Scale LH appears has a hard time creating tones that are easy to distinguish when lightness is too high.

<img width="1354" alt="Screenshot 2024-02-17 at 1 40 02 AM" src="https://github.com/w3c/csswg-drafts/assets/1055125/86066112-6364-47be-accb-2a6b0277701a">

If we apply the same lightness scaling to Scale LH, we still have the same issue in the 90%+ region, but the rest does look good.

<img width="1349" alt="Screenshot 2024-02-17 at 1 48 07 AM" src="https://github.com/w3c/csswg-drafts/assets/1055125/60cee443-9d20-4a45-973d-905343ab9617">











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


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

Received on Saturday, 17 February 2024 08:55:57 UTC