Re: [csswg-drafts] [css-color-4] Clarify how interpolation / premultiplication works for colors with "missing"/`none` alpha components (#6967)

Gosh this is almost like being n Candidate Recommendation, where the spec is improved by feedback from implementers.

So, in [4.3. "Missing"/none Color Components](https://drafts.csswg.org/css-color/#missing) I see

> If a color with a missing component is interpolated with another color, the missing component is treated as having the other color’s component value. If both colors are missing the given component, the interpolated color will also be missing that component.

and that clearly belongs in a new subsection of [12. Interpolation](https://drafts.csswg.org/css-color/#interpolation), after 12.1 Color space for interpolation and before 12.2. Interpolating with alpha.

If there is **one** missing component, the rule is clear - the value from the other color is used, so by the time we get to alpha premultiplication there are no `none` values.

If there are **two** though, we still have `none`. Now, we could force it to zero, at which point alpha premultiplication and un-premultiplication has no effect because 0 × alpha = 0. Or we could leave it `none` and say this component is unaffected by alpha premultiplication (in code, NaN × 0 = NaN) and the value in the interpolated result is still `none`.

I guess the only difference is, not when the interpolated result is used directly, but when it takes part in another interpolation.

For example, if a gradient stop is being animated between two values, both of which have (the same) missing value, and then the interpolated stop value takes part in gradient interpolation with the preceding and following color stops. We would want to preserve the `none`, right?

So I think that is what we should do (and this would be a great example for the spec too, now I think about it).

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


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

Received on Friday, 21 January 2022 13:31:28 UTC