[csswg-drafts] [css-color] (#6059)

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

== [css-color] ==
CSS Color 4 [says that](https://drafts.csswg.org/css-color-4/#interpolation-space)

> Colors are first converted to Lab and then interpolated as Lab colors.
> Host syntax can override the interpolation color space and specify which color space is used for interpolation.

which is fine, and for example CSS Color 5 [`color-mix()`](https://drafts.csswg.org/css-color-5/#color-mix) says

> The perceptually uniform ``lch()`` colorspace is used for mixing by default, as this has no gamut restrictions and colors are evenly distributed. However, other colorspaces can be specified,

So far so good. However CSS Color 4 [also says ](https://drafts.csswg.org/css-color-4/#interpolation-space)

> The exception is that if all the <color>s to be interpolated are sRGB values, and they are all expressed in a legacy syntax such as hex colors, named colors, rgb(), hsl() or hwb() (and the equivalent alpha-including forms) then they are interpolated in gamma-encoded sRGB space.

This was added to account for legacy sRGB-only syntax like CSS Transitions, CSS Animations, and CSS Gradients, to maintain Web Compatibility. It wasn't intended to be needed for newer, multi-colorspace syntaxes.

The ambiguity is whether the "host syntax override" also changes this, which I believe was the intent. Without that override, if you ave say a `color-mix()` between say `lime` and `color(display-p3 0.8385 0.4296 0.1971)` and then you change that second color to rgb(90% 40% 10%) (which is the same actual color) then whoops, both are now in legacy sRGB syntax so the interpolation suddenly changes from `lch` to `srgb` giving wildly different results!

![image](https://user-images.githubusercontent.com/2506926/109562559-8ccada00-7aac-11eb-9b6a-8d507616754f.png)

[Editable version of this example](https://colorjs.io/notebook/?storage=https%3A%2F%2Fgist.github.com%2Fsvgeesus%2Fb0e2c2d84fd859f17645ce8a186478c7)

See also [Consider allowing multiple color-adjusters to be used in color-adjust()](https://github.com/w3c/csswg-drafts/issues/6051)


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


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

Received on Monday, 1 March 2021 21:39:19 UTC