Re: [csswg-drafts] [css-color-4] Consider not basing interpolation color space on input color types (#6914)

Interpolating in gamma-encoded sRGB is legacy handling, as it tends to produce _**terrible**_ results (for the lulz, try to interpolate between `lime` and `red`). The current spec is a compromise between better interpolation handling and web compat.
I would be fine with deciding to interpolate *everything* in oklab or lab unless otherwise specified, but it's nonsensical to force non-legacy colors (e.g. think of a gradient between two oklab colors) to interpolate in gamma-encoded sRGB, nor should we suddenly require all gradients to specify an explicit interpolation space.



> I don't think changing the interpolation color space based on input types (e.g. legacy sRGB formats vs. newer formats) is a good idea, as this could easily lead to surprising results with just small changes to input. For instance, if a gradient specified like:
> 
> `linear-gradient(red, blue)`
> 
> is changed to
> 
> `linear-graident(color(srgb 1 0 0), color(srgb 0 0 1))`
> 
> I would not expect a change.

This is intentional, so that people can opt in to improved interpolation by using a non-legacy format.

> This is exacerbated by the use of CSS variables, where the definition of the color values might not be local to the use.

In those cases there is no compat issue, so no need to interpolate in sRGB.

In general, the idea here is that the **only** use cases for interpolating in gamma-encoded sRGB are compat. If you believe that assumption is wrong, we should have a different discussion, and we'd love to hear all about these other use cases.

> I propose we leave the current host syntaxes for interpolation (gradient, animation, transition, etc.) alone by specifying they use sRGB unless a syntax for specifying the interpolation space is explicitly specified **(like we now have for gradients)**. 

We do? That should be changed if so. Gradients should also interpolate in oklab, unless all colors are legacy.



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


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

Received on Wednesday, 29 December 2021 20:36:52 UTC