Re: [csswg-drafts] [css-color-4][css-color-5] rgb-to-hwb algorithm disagrees indirectly with relative-color-out-of-gamut and color-mix-out-of-gamut expectations (#10695)

Good eye @svgeesus !
I actually implemented my proposed fix before diving deeper into root causes, and followed what another correct-looking implementation was doing. It didn't have this `+ (green < blue ? 6 : 0)` trick, but instead a later catch-all `if (hue < 0) { hue += 360; }`, which seemed a bit clearer, and safer to me because it could catch other potential negative hue from other branches.
But if you think that this `rgbToHsl`-derived code is 100% safe and preferable, I'd be happy to go with that optimization.

Back to my rambling about tests, it'd be nice to have more test cases that would cover all possible code paths (in both versions), to ensure this optimization doesn't break anything.

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


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

Received on Wednesday, 7 August 2024 01:20:29 UTC