Re: [csswg-drafts] [css-images-4] Rendering gradients with missing color components (#9295)

Resurrecting this discussion, as I've found one more ambiguous edge-case in https://drafts.csswg.org/css-color-4/#interpolation-missing.

What happens when interpolating between two achromatic colors with hue-interpolation-method set to longer? My actual test case is something like `linear-gradient(to right in oklch longer hue, white white)` https://codepen.io/brianosman/pen/WNPrrQr

For chromatic colors, the results are well-defined - we do a full hue rotation. But for achromatic colors, we're back to an (under-specified?) situation. We know (12.2) that:

> If both colors are missing a given component, the interpolated color will also be missing that component.

Elsewhere:

> For handling of missing component in color interpolation, see § 12.2 Interpolating with Missing Components.
> For all other purposes, a missing component behaves as a zero value ...

But the substitution of zero for missing components doesn't seem ordered with the other steps? So do we treat them both as zero, then do a full hue rotation of zero to 360, or is that somehow skipped and we just fail to respect longer (but only for pairs of achromatic colors)? The current code in Blink/Skia happens to produce the latter result (by accident, I think), but I'd like to get it right while I'm working on this again.

[1] Side-note: There's a tiny error in the documentation for `longer`. It says: "Angles are adjusted so that θ₂ - θ₁ ∈ {(-360, -180], [180, 360)}.". That last `)` should be `]`.

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


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

Received on Friday, 27 October 2023 18:37:32 UTC