[csswg-drafts] [css-color-4] Define color interpolation in one place, reference that in other specs (#5883)

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

== [css-color-4] Define color interpolation in one place, reference that in other specs ==
Surprisingly, [Color 4](https://www.w3.org/TR/css-color-4/) does not actually have an interpolation section.
[Color 5](https://www.w3.org/TR/css-color-5/) [does](https://drafts.csswg.org/css-color-5/#interpolation), and [Color 4 is even referencing Color 5](https://drafts.csswg.org/css-color-4/#ref-for-angle-value:~:text=This%20impacts%2C%20for%20example%2C%20hue%20interpolation.) in a section.
[Images 3 on the other hand defines its own interpolation rules](https://drafts.csswg.org/css-images-3/#coloring-gradient-line), and specifies that gradients interpolated in premultiplied (gamma-corrected) RGBA, which is clearly from back when all we were dealing with were sRGB colors (though interpolating in gamma-corrected space is suboptimal for those too).

**Where to define interpolation?** Since Color 4 defines the actual color values, Color 4 needs to define how they interpolate. We cannot define values in one level and interpolation in the next level and we can't have level N citing level N+1.

**How to interpolate?** In previous discussions, the rule we had discussed was that [if two colors are in the same color space, they interpolate in that color space](https://drafts.csswg.org/css-color-5/#interpolation-space), otherwise in Lab. After further thinking, I don't think that's a good idea. It does maintain backwards compat for old sRGB forms, but it forces new RGB forms like `color(display-p3)` or even `color(srgb)` (which we resolved in #5825 that is stored separately from legacy sRGB formats) to also interpolate in gamma-corrected space. Instead, I think the rule should be that colors interpolate in Lab (or XYZ), *unless* both colors being interpolated are legacy sRGB forms (for backwards compat) OR the host syntax defines a different interpolation space (e.g. [`color-mix()`](https://drafts.csswg.org/css-color-5/#color-mix)).



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


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

Received on Wednesday, 20 January 2021 18:24:07 UTC