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

weinig has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-4] Consider not basing interpolation color space on input color types ==
In CSS Color 4's section on interpolation, https://drafts.csswg.org/css-color-4/#interpolation-space, it states:

> If the host syntax does not define what color space interpolation should take place in, it defaults to OKLab.
>
> However, user agents may handle interpolation between legacy sRGB color formats (hex colors, named colors, rgb(), hsl() or hwb() and the equivalent alpha-including forms) in gamma-encoded sRGB space. This provides Web compatibility; legacy sRGB content interpolates in the sRGB space by default.

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 exacerbated by the use of CSS variables, where the definition of the color values might not be local to the use.

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). Additionally we would encourage any additional uses of interpolation to consider either always requiring the interpolation space (like color-mix) or defaulting to OKLab (though the former is preferred by me, as predicting what our future selves will think is a good interpolation color space is quite difficult).



(It's possible I have filed something like this in the past, but I couldn't recall. If so, apologies for the double report).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6914 using your GitHub account


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

Received on Saturday, 25 December 2021 19:05:19 UTC