[Webkit-unassigned] [Bug 287637] Color space conversion converts oklch hue to 0 for low chroma colors
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Feb 13 18:41:15 PST 2025
https://bugs.webkit.org/show_bug.cgi?id=287637
--- Comment #2 from Sam Weinig <sam at webkit.org> ---
Taking just the case relative color case (since that is simpler) of `oklch(from #e5f6ff l c h)`, we have the following conversion chain:
sRGB (8-bit) -> sRGB (float)
sRGB (float) -> linear SRGB (float)
linear SRGB (float) -> xyz-d50 (float)
xyz-d50 (float) -> oklab (float)
oklab (float) -> oklch (float)
We can simplify things by starting with `oklab(0.963236391 -0.0137705645 -0.0167271886)` instead of #e5f6ff, and we can see the same issue, so we know its an issue in the polar form conversion.
What seems to be going on here is that the code to detect acromatic colors is improperly getting triggered. It sees that both abs(`a`) and abs(`b`) are less than 0.02, our chosen epsilon, and sets the hue to `none`.
I can't recall why 0.02 was chosen as the epsilon, but clearly it is too way too big. My guess is that we chose it lab -> lch, where values are much bigger, and we just need a separate epsilon for lab -> oklch here that is a bit smaller.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20250214/9a6b0cbb/attachment-0001.htm>
More information about the webkit-unassigned
mailing list