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

@romainmenke based on my understanding, it appears your first example is correct. I am assuming you are using oklch for gamut mapping as that is the only way I can get your results.

```py
>>> result = Color('oklch(100% 50% 60deg)').mix('oklch(50% 50% 0deg)', space='oklch')
>>> result.to_string()
'oklch(0.75 0.2 30)'
>>> result.convert('srgb').fit(method='oklch-chroma').to_string()
'rgb(255 124.21 104.02)'
```

The second seems like it is **not** treating hue as powerless even though you are stating it is. I can get your RGB result, but the OkLCh result shows that the hue was not being treated as powerless:

```py
>>> result = Color('oklch(75% 0% 60deg)').mix('oklch(75% 50% 0deg)', space='oklch')
>>> result.to_string()
'oklch(0.75 0.1 30)'
>>> result.convert('srgb').fit(method='oklch-chroma').to_string()
'rgb(230.28 149.72 136.2)'
```

If we truly treat hue as powerless, the results would be like this:

```py
>>> result = Color('oklch(75% 0% none)').mix('oklch(75% 50% 0deg)', space='oklch')
>>> result.to_string()
'oklch(0.75 0.1 0)'
>>> result.convert('srgb').fit(method='oklch-chroma').to_string()
'rgb(226.44 146.99 171.23)'
```

One more thing. I'd also recommend to employ when chroma is sufficiently close to zero that it hue is treated as undefined. The perils of floating point math will often give you a very close, but not zero value for chroma due to the algorithm. This is mentioned in the spec, but provides no real guidance on what "sufficiently close" is.

> User agents may treat a component as [powerless](https://www.w3.org/TR/css-color-4/#powerless-color-component) if the color is "sufficiently close" to the precise conditions specified.





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


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

Received on Tuesday, 22 August 2023 12:37:42 UTC