Re: [csswg-drafts] [css-color-4] Use `0` chroma when hue is powerless during conversion (#14133)

> The hue isn't really powerless when converting to another colorspace and that is kinda the point :)
It will always be set to 0 to make the maths work.

Yes, if the hue is undefined, then it must be set to something, and 0 is fine, but it could be anything.

Here we normalize hue such that it is undefined and we avoid setting chroma to zero and also set chroma to zero. We get whatever hue floating-point noise gives us:

```py
>>> c.normalize().convert('oklch', norm=False)
color(--oklch 0.56897 0 359.51deg / 1)
>>> c.normalize().set('c', 0).convert('oklch', norm=False)
color(--oklch 0.56897 0 170.54deg / 1)
```

> Otherwise the result can be a color that is barely but still measurably chromatic.
While setting the chroma to 0 does seem to produce very good results:

Yeah, but none of that is visually significant. What this means is that maybe the achromatic threshold for chroma is too large. But, yes, you could force chroma to zero to make it clamp the value to a true achromatic value.




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


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

Received on Monday, 6 July 2026 19:58:00 UTC