Re: [csswg-drafts] [css-images-4] Clarifying CSS gradient rendering for edge cases involving "longer hue" interpolation (#11381)

> As an aside, we should also probably think about exactly what behavior we _do_ want between a double-position stop like that. Double-position stops were added to make it easy to generate solid-color strips in a gradient without having to repeat your color; I suspect that people might expect that to remain true even if they're doing longer-hue interpolation otherwise.

Hmm, yes, I suppose that might take people by surprise.

The [spec text](https://drafts.csswg.org/css-images-4/#color-stop-syntax) currently says that:

> A [color stop](https://drafts.csswg.org/css-images-4/#color-stop) with two positions is equivalent to specifying two color stops with the same color, one for each position.

which means that `linear-gradient(in hsl longer hue, red 0% 100%)` should be exactly equivalent to `linear-gradient(in hsl longer hue, red 0%, red 100%)` (or indeed to `linear-gradient(in hsl longer hue, red, red)`). I'd be a bit reluctant to break that equivalence by giving a "double-position stop" some kind of special handling, distinct from two separately-defined stops with the same color.

The spec goes on to mention that:

> Specifying two locations makes it easier to create solid-color "stripes" in a gradient, without having to repeat the color twice.

Perhaps a note should be added here clarifying that _this does not apply to `longer hue` gradients_, because it is inherent in longer-hue gradients that between one stop and a following stop of the same color, there will be a complete "cycle" of color rather than a band of solid color.

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


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

Received on Thursday, 13 February 2025 09:25:29 UTC