Re: [csswg-drafts] [css-color-4] Inconsistent results with `none` and interpolation color spaces. (#8563)

After giving it more thought and continuing with implementation I am still seeing some unexpected results.

---------

Are these steps correct?

starting with `hsl(90deg 100% none)`

https://drafts.csswg.org/css-color-4/#interpolation-missing

> In the course of converting the two colors to the [interpolation color space](https://drafts.csswg.org/css-color-4/#interpolation-color-space), any [missing components](https://drafts.csswg.org/css-color-4/#missing-color-component) will be replaced with the value 0.

After replacing `none` with `0` :

`hsl(90deg 100% 0%)`

----------------------

After conversion to oklch : 

`oklch(0 0 0)`

----------------------

`L` is 0 and `C` and `H` would become powerless.
But I am unsure if `C` and `H` would need to be handled as such.

Handling them as missing components would result in `oklch(none none none)` later on.

----------------------

https://drafts.csswg.org/css-color-4/#interpolation-missing

> Thus, the first stage in interpolating two colors is to classify any [missing components](https://drafts.csswg.org/css-color-4/#missing-color-component) in the input colors, and compare them to the components of the [interpolation color space](https://drafts.csswg.org/css-color-4/#interpolation-color-space). If any [analogous components](https://drafts.csswg.org/css-color-4/#analogous-components) which are missing components are found, they will be carried forward and re-inserted in the converted color before linear interpolation takes place.

Lightness is missing but has an analogous component in oklch.

`oklch(none 0 0)`

-------------------------

https://drafts.csswg.org/css-color-4/#ex-analogous-hue

> If a color with a carried forward [missing component](https://drafts.csswg.org/css-color-4/#missing-color-component) is interpolated with another color which is not missing that component, the missing component is treated as having the other color’s component value.

When mixing with `oklch(89% 0.265 135.9)`

`oklch(89% 0 0)`

After linear interpolation :

`oklch(89% 0.1325 62.95)`

The actual result in Chrome is :

`oklch(44.5% 0.1325 135.9)`

- `L` was interpolated between `0` and `89%`. The missing component was not carried over.
- `C` was interpolated between `0` and `0.265`
- `H` Chrome treats `H` as powerless/missing and was carried over, because `C` is `0`

----------

I am definitely missing a step where I should be handling powerless components, this explains the difference in `H` between Chrome and results on my end.

But I don't get why the missing `L` component wasn't carried over.
Are these not analogous?

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


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

Received on Thursday, 16 March 2023 16:40:21 UTC