Skip to content

[css-color-4] set chroma to 0 when converting powerless hue to missing - #14244

Open
romainmenke wants to merge 4 commits into
w3c:mainfrom
romainmenke:css-color-4-force-zero-chroma-for-powerless-hue--rational-giant-schnauzer-b9b92297b1
Open

[css-color-4] set chroma to 0 when converting powerless hue to missing#14244
romainmenke wants to merge 4 commits into
w3c:mainfrom
romainmenke:css-color-4-force-zero-chroma-for-powerless-hue--rational-giant-schnauzer-b9b92297b1

Conversation

@romainmenke

Copy link
Copy Markdown
Member

@svgeesus svgeesus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; one suggested link

Comment thread css-color-4/Overview.bs Outdated
Co-authored-by: Chris Lilley <chris@w3.org>
Comment thread css-color-4/Overview.bs Outdated
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.
In the case of ''hwb'' set ''b'' to ''100 - w'' or if either ''b'' or ''w'' is missing set the other component to ''100''.

@romainmenke romainmenke Jul 31, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For hwb this must only be done when W + B >= 99.999 and W + B < 100 to avoid clamping.

Maybe clearer in pseudo code than in prose?

1. if `w` + `b` is greater than `99.999` and `w` + `b` is less than `100`
2. if `w` and `b` are not missing
  2.1. set `b` to `100 - w`
3. else if `w` is not missing
  3.1. set `w` to `100`
4. else if `b` is not missing
  4.1. set `b` to `100`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is much clearer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if condition on 1. covers 2. to 4. if true, right?

@romainmenke romainmenke Aug 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Maybe clearer:

1. if `w` + `b` is greater than `99.999` and less than `100` and `w` and `b` are not missing
...

Or:

1. if `w` + `b` is greater than `99.999` and `w` + `b` is less than `100`
  1.1. if `w` and `b` are not missing
    1.1.1. set `b` to `100 - w`
  1.2. else if `w` is not missing
    1.2.1. set `w` to `100`
  1.3. else if `b` is not missing
    1.3.1. set `b` to `100`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have applied the second option and also replaced 99.999 with ε.

I've also added a clarification that this step should only be applied for other color spaces between zero and ε.

@romainmenke
romainmenke marked this pull request as ready for review August 14, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants