Re: [csswg-drafts] [css-color-5] Gamut mapping in HSL/HWB (#7107)

Oh, another thing specifically about the gamut mapping algorithm that I found by looking at WebKit's implementation was how to deal with colors with OKLCH lightness values that are 0% or >= 100%. There were some tests that didn't pass without handling those edge cases specifically.

https://github.com/WebKit/WebKit/blob/0d33053bc9c52320e9aa6ce13529b7a0a27d1f9e/Source/WebCore/platform/graphics/ColorConversion.h#L195-L198

Example test:

```js
test_computed_value(`color`, `color-mix(in hsl, oklab(100% 0.365 -0.16) 100%, rgb(0, 0, 0) 0%)`, `rgb(255, 255, 255)`); // Naive clip based mapping would give rgb(255, 92, 255).
```

However, without the extra conditions that WebKit added for whites and blacks, I get `rgb(255, 249, 255)` by the binary search algorithm. Should those conditions be added to the spec or is the test incorrect?

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


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

Received on Monday, 7 March 2022 20:12:38 UTC