Re: [csswg-drafts] [css-color-5] Make interpolation method optional in `color-mix()`? (#11532)

The CSS Working Group just discussed ``[css-color-5] Make interpolation method optional in `color-mix()`?``.

<details><summary>The full IRC log of that discussion</summary>
&lt;kbabbitt> lea: a while back we resolved to have mandatory interpolation color space in color-mix()<br>
&lt;kbabbitt> ... because we worried ,what if a better color space comes along?<br>
&lt;kbabbitt> ... for interpolation<br>
&lt;kbabbitt> ... reality is that this has become noise in the fn<br>
&lt;ChrisL> q+<br>
&lt;kbabbitt> ... authors do not make informed decisions we expected<br>
&lt;astearns> zakim, open queue<br>
&lt;Zakim> ok, astearns, the speaker queue is open<br>
&lt;kbabbitt> ... they specify srgb not because they want to interpolate there but htat's the color space they're familiar with<br>
&lt;astearns> q+ ChrisL<br>
&lt;weinig> q+<br>
&lt;kbabbitt> ... or they think they have to because colors are srgb<br>
&lt;kbabbitt> ... we can make a more informed choice for this default<br>
&lt;kbabbitt> ... even if there's a better default later, this is better than what authors are currently doing<br>
&lt;kbabbitt> ... we also resolved lab should be default for gradients<br>
&lt;kbabbitt> ... we do have in gradients you don't have to specify interpolation space<br>
&lt;kbabbitt> ... so this would harmonize<br>
&lt;kbabbitt> ... I was in favor of not having a default, I think it would be a net gain to have a default now<br>
&lt;emilio> q+<br>
&lt;emilio> ack ChrisL<br>
&lt;astearns> ack ChrisL<br>
&lt;kbabbitt> weinig: I wanted us not to have a default<br>
&lt;astearns> ack weinig<br>
&lt;kbabbitt> ... I still think it's the right choice<br>
&lt;kbabbitt> ... in general I think the places where we've not been explicit about color spaces<br>
&lt;kbabbitt> ... have by and large been a mistake<br>
&lt;kbabbitt> ... and hard to claw back<br>
&lt;kbabbitt> ... if we live in a world where there are color spaces and people writing code for our platforms, they need to be aware of them<br>
&lt;lea> q+<br>
&lt;kbabbitt> ... I don't think hiding them has been an effective strategy<br>
&lt;ChrisL> qq+<br>
&lt;kbabbitt> ... in the engines, or the APIs we produce<br>
&lt;kbabbitt> ... people using srgb as default feels like educational problem which is solvable<br>
&lt;kbabbitt> ... not necessarily reason to force different default<br>
&lt;astearns> ack ChrisL<br>
&lt;Zakim> ChrisL, you wanted to react to weinig<br>
&lt;kbabbitt> ChrisL: you've exactly captured my viewpoint from 6 months ago<br>
&lt;kbabbitt> ... we give them that, they make good choices, they make terrible choices<br>
&lt;kbabbitt> weinig; I don't think people will make good choices to begin with, they make bad choices all the time<br>
&lt;kbabbitt> ... but I think in the expanse of time as more articles come out and more people come to understand what these concepts mean<br>
&lt;kbabbitt> ... that is a net positive<br>
&lt;kbabbitt> ... giving people the runway to learn these concepts is useful<br>
&lt;kbabbitt> ... slipping them under covers is useful in short term but not long term<br>
&lt;ChrisL> q?<br>
&lt;astearns> ack emilio<br>
&lt;kbabbitt> emilio: 2 questions<br>
&lt;kbabbitt> ... presumably if you mix with transparent the result is what you expect regardless of color space<br>
&lt;kbabbitt> ... or are there weird things there/<br>
&lt;florian> q+<br>
&lt;kbabbitt> ... I want to make this color semi transparent<br>
&lt;kbabbitt> weinig: if all you do is augment alpha that's same for all color spaces<br>
&lt;kbabbitt> emilio: right<br>
&lt;kbabbitt> ... does result color space depend on interpolation method?<br>
&lt;kbabbitt> weinig: there's not a concept of result color space<br>
&lt;kbabbitt> ... colors are colors and how you use them enforces color space<br>
&lt;kbabbitt> emilio: but you need to serialize ...<br>
&lt;kbabbitt> weinig: it serializes as what you mixed as i.e. output<br>
&lt;kbabbitt> ... in this proposal, output of color-mix will be by default oklab()<br>
&lt;kbabbitt> emilio: could be surprising<br>
&lt;kbabbitt> ... you omit color space, mix red + transparent and get some oklch value<br>
&lt;kbabbitt> ... have mixed feelings about this<br>
&lt;kbabbitt> ... if colors wouldn't be read so much from script I'd be happy to do this<br>
&lt;kbabbitt> ... maybe it's fine anyway<br>
&lt;kbabbitt> ... and people will ditch their old script<br>
&lt;kbabbitt> ... it's common to mix srgb colors, call gCS, and parse an rgba value<br>
&lt;kbabbitt> ... which would no longer work<br>
&lt;kbabbitt> weinig: it would already no longer work because modern syntax<br>
&lt;lea> q?<br>
&lt;kbabbitt> emilio: I think you get legacy syntax given legacy input<br>
&lt;astearns> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to ask stupid question about color-interpolation property<br>
&lt;kbabbitt> ... not objecting, just curious about surprising behaviors<br>
&lt;kbabbitt> fantasai: why dont we make color interpolation methods optional<br>
&lt;kbabbitt> ... and have color-interpolation properthy that sets default?<br>
&lt;ChrisL> you don't get the result in a legacy colorspace, see https://drafts.csswg.org/css-color-5/#serial-color-mix<br>
&lt;kbabbitt> lea: even if down the line a better color space comes along<br>
&lt;kbabbitt> .. I think it would be good to give authors a way to set default color interpoliation space<br>
&lt;kbabbitt> ... not as simple as providing a property<br>
&lt;kbabbitt> ... because different use cases need different interpolation spaces<br>
&lt;kbabbitt> ... but I think that's right direction<br>
&lt;kbabbitt> ... also there was a concern we shouldn't try to protect authors from bad choices<br>
&lt;kbabbitt> ... ironic because we were worried in color-contrast about protecting authors from bad choices<br>
&lt;kbabbitt> ... in general I think we give sensible defaults to reduce author cognitive overhead<br>
&lt;fantasai> lea+++++++++<br>
&lt;kbabbitt> ... e.g. layout has many smart defaults so people don't ahve to understand grid intricacies<br>
&lt;kbabbitt> ... taht's why sensible defaults are a design principle<br>
&lt;kbabbitt> ... re: emilio - good point, it might be unexpected if authors did not define color space, to get oklab after specifying srgb<br>
&lt;kbabbitt> ... interpolation color space and result color space do not beed to be the same<br>
&lt;fantasai> ChrisL, why is that a problem? you opted into it<br>
&lt;kbabbitt> .. coud define color returned in color space of first arghument<br>
&lt;kbabbitt> ... we can do these things, but it's a separate decision\<br>
&lt;kbabbitt> ... e.g. what color space result is in<br>
&lt;kbabbitt> ... interpolation can still be in oklab<br>
&lt;ChrisL> qq+<br>
&lt;astearns> ack ChrisL<br>
&lt;Zakim> ChrisL, you wanted to react to fantasai<br>
&lt;astearns> ack lea<br>
&lt;kbabbitt> ChrisL: emilio - the thing you said was wrong, quoted spec<br>
&lt;kbabbitt> ... [missed]<br>
&lt;kbabbitt> emilio: if you do color-mix in oklab, red 50%, blue<br>
&lt;kbabbitt> ... you get an oklab color<br>
&lt;kbabbitt> ... that's expected since you mix in okalb<br>
&lt;lea> s/... [missed]/lea: but in color-mix() without an interpolation space, it's implicit/<br>
&lt;kbabbitt> ... but if you omit and do color mix red blue<br>
&lt;kbabbitt> ... it might be unexpected to get back oklab<br>
&lt;kbabbitt> ... if the color space was dependent on inputs this wouldn't be an issue<br>
&lt;astearns> ack florian<br>
&lt;kbabbitt> florian: agree with lea that we should separate question of serialization and interpolation color space<br>
&lt;kbabbitt> ... they don't have to be the same<br>
&lt;kbabbitt> ... we can have separate rules for serialization<br>
&lt;kbabbitt> ... if we don't want to be silent on main point because authors should think about this<br>
&lt;kbabbitt> ... and it's a point of education<br>
&lt;lea> We could even specify that before 50% you use the color space of the first color and >= 50% the color space of the second color :P<br>
&lt;kbabbitt> ... but also want to allow authors to not worry about it<br>
&lt;fantasai> :P<br>
&lt;kbabbitt> ... could give them an auto keyword<br>
&lt;kbabbitt> ... which is more inviting when you don't want to do than oklab<br>
&lt;kbabbitt> ... possibly we don't want to do that either and instead have separate value<br>
&lt;kbabbitt> ... but auto might be more discoverable<br>
&lt;kbabbitt> astearns: re: auto value - it would only make sense to add auto if there were different defaults to be used in various circumstances<br>
&lt;kbabbitt> ... if there's a single thing we're going to use in auto case, makes more sense to express it as omittable parameter<br>
&lt;kbabbitt> q+<br>
&lt;emilio> q+<br>
&lt;astearns> ack kbabbitt<br>
&lt;TabAtkins> kbabbitt: one thing just occurred to me about auto value<br>
&lt;TabAtkins> kbabbitt: if in the future we discover a color space we want to use isntead, authors dont' have to change their code<br>
&lt;TabAtkins> kbabbitt: tho i suppose that's true with the omitted vlaue too<br>
&lt;astearns> ack emilio<br>
&lt;kbabbitt> emilio: another q is, if we do this, do we want to serialize color-mix itself<br>
&lt;kbabbitt> ... if you specify color mix in oklab that may be what happens in gradients now<br>
&lt;lea> q+<br>
&lt;kbabbitt> ... do we make omission special or do we change color-mix in oklab to omit oklab as well<br>
&lt;astearns> ack lea<br>
&lt;kbabbitt> lea: I think it should be special so that down the line when we have a separate property that gets automatically applied<br>
&lt;kbabbitt> ... otherwise when they read value back they start relying on it<br>
&lt;fantasai> +1<br>
&lt;kbabbitt> ... and it's harder to change down the line<br>
&lt;kbabbitt> emilio: that's an issue regardless<br>
&lt;kbabbitt> ... if result is in oklab then you know what you used manually<br>
&lt;lea> q+ to say roundtripping<br>
&lt;kbabbitt> fantasai: [missed]<br>
&lt;kbabbitt> emilio: I don't think that makes it harder to change it, harder to rely on oklab by default<br>
&lt;kbabbitt> lea: another reason not to include color space is roundtripping<br>
&lt;kbabbitt> ... it should be easy to read value and plug back in without chaning what you have<br>
&lt;weinig> q+<br>
&lt;kbabbitt> ... once interpolation space becomes independent it becomes coupled in the value<br>
&lt;astearns> ack lea<br>
&lt;Zakim> lea, you wanted to say roundtripping<br>
&lt;kbabbitt> ... if you read it and write it back you override what was in value<br>
&lt;kbabbitt> emilio: what we would do now if we say oklab is defauklt<br>
&lt;kbabbitt> ... if you specify oklab we'd omit it<br>
&lt;kbabbitt> lea: if someone explicitly spercifies it htat's author intent<br>
&lt;kbabbitt> ... we should not just drop it<br>
&lt;kbabbitt> weinig: we would by current serialization rules<br>
&lt;kbabbitt> emilio: I don't mind either way but I think TabAtkins had strong opinions about having special values by omiision<br>
&lt;kbabbitt> ... maybe we should ahve a keyword for this even if we omit by default<br>
&lt;kbabbitt> ... don't think dropping in oklab as long as it's a default is aproblem<br>
&lt;kbabbitt> ...doesn't make it hard ot change down the line<br>
&lt;astearns> ack weinig<br>
&lt;kbabbitt> weinig: in terms of taking this idea that at some point in future we might define interpolation space property<br>
&lt;kbabbitt> ... I think that's a good reason to put this on hold until then<br>
&lt;kbabbitt> ... because if we want to do something where color mix takes on the inherited color interpolation space<br>
&lt;lea> q+<br>
&lt;TabAtkins> especially in a case like this, where the keyword is preceded by anotehr keyword, it's important to have every value explicitly writeable. Otherwise you can't write `color-mix(in var(--color-space), ...)` and have all options available<br>
&lt;kbabbitt> ... that would be just as surprising to other people<br>
&lt;kbabbitt> ... that suddenly color mixes that set interpolation space are suddenly changed<br>
&lt;kbabbitt> ... if we are going to change it and change defaults, or remove/add efaults<br>
&lt;kbabbitt> ... doing them together as a unified piece would make sense<br>
&lt;TabAtkins> (you'd have to instead write `color-mix(var(--color-space))`, and write `--color-space: in oklab`, which is awkward)<br>
&lt;kbabbitt> ... still don't think having a default here is necessaty<br>
&lt;astearns> ack lea<br>
&lt;kbabbitt> ... especially given that colort spaces evolve<br>
&lt;kbabbitt> lea: a lot of history in having knobs that people can control through CSS properties<br>
&lt;kbabbitt> ... transition-behavior; allow-discrete was one<br>
&lt;kbabbitt> ... same argument could be made about that<br>
&lt;kbabbitt> ... or size interpolation<br>
&lt;kbabbitt> ... property that tweaks how that works<br>
&lt;kbabbitt> ... that's how we frequently do things<br>
&lt;bramus> q?<br>
&lt;kbabbitt> ... if you take the effort to specify this property, anything that deoesn' have an interpolation space gets default seems reasonable<br>
&lt;bramus> q+<br>
&lt;kbabbitt> ... I don't think we should continue same current situation for a number of reasons mentioned<br>
&lt;kbabbitt> ... not just one, authors are making poor choices<br>
&lt;kbabbitt> ... potential for errors, even myself I forget to specify and am unsure why it doesn't interpolate<br>
&lt;kbabbitt> ... it's verbose<br>
&lt;kbabbitt> ... many reasons to omit this<br>
&lt;argyle> +1 lol, i've forgotten to put the colorspace in there multiple times<br>
&lt;kbabbitt> ... there should be a way to specify default<br>
&lt;kbabbitt> ... but unless you're using a var like that you shouldn't have to specify<br>
&lt;kbabbitt> ... but there should aloso be a way to specify to use a fallback<br>
&lt;kbabbitt> weinig: if we're going to add that thing, doing both changes simultaneously so authors learn would be preferred<br>
&lt;kbabbitt> astearns: in interest of time, let's take back to issue<br>
&lt;kbabbitt> ... hearing reservations<br>
&lt;lea> is anyone else actually objecting?<br>
&lt;bramus> https://github.com/w3c/csswg-drafts/issues/9109 could solve this<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11532#issuecomment-2625706594 using your GitHub account


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

Received on Thursday, 30 January 2025 22:12:49 UTC