You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-color-4] Clarify setting "colorful" components to zero when changing a powerless hue component to a missing component #14531
When changing a powerless hue component to a missing component, the chroma (or other measure of colorfulness, such as saturation in hsl; see analogous components) is set to zero to avoid amplifying floating-point noise. Negative values are not clamped to zero, this value is only set to zero when it is larger than zero but smaller or equal to ε
However, the specific algorithms (both normative and non-normative) don't seem to perform this zeroing.
In HWB it is possible to have an achromatic color (W + B equal or greater than 100) that also has a missing W or B.
So the pseudo code tries to describe how to deal with that.
If neither is missing, W and B can be normalized by setting B to 100 - W.
If either is missing, set the non-missing one to 100.
For hwb at least it is important to only do these steps when between the epsilon and 100 as values larger than 100 are possible.
In my implementation I also only set s or c to zero when it has a value between zero and epsilon. Negative values (if those are even possible) are preserved.
If there is a better way to describe this, please make a suggestion :)
I'm confused how W + B > 100 can be true when W or B is missing. Is the premise that if one is missing the other is itself > 100 so when added to 0 (the resolved missing value) it is still greater than 100?
Activity
romainmenke commentedon Sep 28, 2026
In HWB it is possible to have an achromatic color (
W+Bequal or greater than 100) that also has a missingWorB.So the pseudo code tries to describe how to deal with that.
If neither is missing,
WandBcan be normalized by settingBto100 - W.If either is missing, set the non-missing one to
100.For
hwbat least it is important to only do these steps when between the epsilon and 100 as values larger than 100 are possible.In my implementation I also only set
sorcto zero when it has a value between zero and epsilon. Negative values (if those are even possible) are preserved.If there is a better way to describe this, please make a suggestion :)
weinig commentedon Sep 28, 2026
Well, the suggestion is for the code snippet that describes the conversion for HWB in the HWB section to include the logic.
weinig commentedon Sep 28, 2026
I'm confused how W + B > 100 can be true when W or B is missing. Is the premise that if one is missing the other is itself > 100 so when added to 0 (the resolved missing value) it is still greater than 100?
romainmenke commentedon Sep 28, 2026
The pseudo code is not limited to cases where either is missing.
e.g.
hsl(from hwb(180 100% 25%) h s l)hasH + B > 100.weinig commentedon Sep 28, 2026
Whatever the rules, let’s add them to the conversion sample.
[css-color-4] Clarified setting "colorful" components to zero when ch…
svgeesus commentedon Oct 27, 2026
@weinig PTAL: