Re: [csswg-drafts] [css-color-4] [css-color-5] inconsistent mentions of powerless components in `white`. (#8609)

@svgeesus https://github.com/w3c/csswg-drafts/commit/96be9333a3b9b63f84d480b1f2df948975ee3ee6

https://drafts.csswg.org/css-color-4/#the-hsl-notation

> If the saturation of an HSL color is 0%, then the hue component is [powerless](https://drafts.csswg.org/css-color-4/#powerless-color-component). If the lightness of an HSL color is 0% or 100%, the hue component is powerless and the saturation is 0%.

HSL still has a powerless hue when lightness is 0% or 100%.
Is this intentional?

----------

> now it is described as a consequence of gamut mapping. A high chroma color with L=100% will display as white, because of gamut mapping

This has a consequence I didn't immediately foresee in my context.

Because I am working with a static analysis / build tool I don't have a display.

[`lab(100 0 10 / 50%)`](https://github.com/web-platform-tests/wpt/blob/d86eab89c1/css/css-color/parsing/color-computed-lab.html#L32)

Before this would be "normalised" as `lab(100 none none / 50%)` which in turn would effectively be `lab(100 0 0 / 50%)`.

However during gamut mapping we use `oklch` and check for almost black and almost white like so :

```
if (oklch[0] < 0.000001) {
 oklch = [0, 0, 0] as Color;
}

if (oklch[0] > 0.999999) {
 oklch = [1, 0, 0] as Color;
}
```

But `lab(100 0 0 / 50%)` in `oklch` is only `oklch(0.99888499 0.025933663 90.59149027 / 0.5)`

Because the threshold isn't met, gamut mapping is applied and the final result is : `rgba(255, 255, 245, 0.5)`

I am fairly certain that this is only observable in my context but wanted to share this just in case.

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8609#issuecomment-1624350754 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 21:48:52 UTC