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

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

I understand its intentional, I just think it is more surprising than useful. I think it would be much more clear and less error prone if people opted into the new improve interpolation by stating an interpolation color space. I can equally see this being confusing going the other way. A gradient that uses a non-legacy color switches that one to some named color (e.g. `blue`) and now all of a sudden the interpolation changes. That feels much harder to teach than just, sRGB is the default legacy interpolation, but we suggest you use one of our better ones!

> > 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.

I was mistaken, the gradient spec doesn't state this, indeed, [it says](https://drafts.csswg.org/css-images-4/#coloring-gradient-line):

> If no `<color-interpolation-method>` is specified in the gradient function, the color space used for gradient interpolation is the default interpolation color space as defined in [css-color-4].

This would be a breaking change in WebKit, where we have been shipping CSS gradients with color stops using `color()` functions for a few years. It might be an acceptable break, but I am not sure. I will check with others on the project to see what they think for some additional feedback here.

To restate my point a bit, in general, I think there is virtue in requiring opting in to this behavior explicitly, via an explicit `in <color-interpolation-method>` as it 1) provides a clear indication of intent, 2) simplifies the understanding of the API of the `gradient()` by having only single default color space, 3) aids in teaching about the different interpolation methods by making it front and center, 4) does not hardcode another default color space choice into the standard that we might one day not think is the right choice (at one point in the past we were ok-ish with sRGB, until recently I believe either CIE Lab or CIE LCH were going to be the default, so it stands to reason that in the future, we may find yet a better pick).

I do agree that this is a tradeoff, and there is also virtue in improving the default color space today, I just don't think that is enough to merit the downsides.

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


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

Received on Friday, 31 December 2021 17:26:00 UTC