Re: [csswg-drafts] [css-color-4] [css-color-5] Mixing with `transparent` seems broken in implementations (#8612)

@emilio wrote:

> the OKLab conversion we do [goes through xyz](https://searchfox.org/mozilla-central/rev/cdddec7fd690700efa4d6b48532cf70155e0386b/servo/components/style/color/mod.rs#324,341), which doesn't end up with a NaN / none hue.

Correct, it needs to go through XYZ (that isn't needed when sRGB colors (rgb, hsl, hwb) are interpolated in an sRGB colorspace).

But the final polar conversion step, Oklab to Oklch or Lab to LCH, should be producing a `none` hue for achromatic colors (black, white, grays) including transparent (which is zero alpha black).

In color.js, `rgba(0 0 0 / 0)` [converts to](https://colorjs.io/apps/convert/?color=rgba(0%200%200%20%2F%200)&precision=10) `[lch(0 0 0 / 0)](https://colorjs.io/apps/convert/?color=lch(0%200%200%20%2F%200)&precision=10)` and `[oklch(0 0 0 / 0)](https://colorjs.io/apps/convert/?color=oklch(0%200%200%20%2F%200)&precision=10)` because we are still coercing the `NaN` hue to zero. We s[hould be outputting `none` there](https://github.com/LeaVerou/color.js/issues/228).

Either way though, when the alpha is zero, the premultiplied `L` and 'C` will be zero and the hue is not affected by premultiplication.

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


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

Received on Thursday, 6 July 2023 13:22:58 UTC