-
Notifications
You must be signed in to change notification settings - Fork 713
[css-transitions][css-animations][web-animations] Add control of colorspace used for transitioning colors #7063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think we should be looking at css-transitions-1 as feature complete, and looking at this for css-transitions-2. |
Thanks, David. Is there agreement that this is the correct approach? If so, would you like a PR to review, or should I just add it? |
I think it probably requires some amount of discussion, though I haven't thought about the issue. My comment above was part of triaging css-transitions-1 issues in the hope of getting that spec to advance. |
Agreed this should be in css-transitions-2. |
There was related discussion in another issue where I said:
If so, I think you'd also need to define how they end up getting represented in Web Animations |
Agenda+ to get CSSWG resolution on this. |
The CSS Working Group just discussed The full IRC log of that discussion<bramus> chris: css color-4 add something that others spec can reference: color interpolation method<bramus> chris: already used for gradients <bramus> chris: proposeal to add same token to animations, transitions, and web animations <bramus> chris: proposal since March without no comments <bramus> chris: cant think of other way to do it <emilio> q+ <bramus> emilio: the idea is to add a transition-interpolation property? <flackr> q+ <bramus> chris: yes <bramus> chris: same for animation-interpolation <bramus> emilio: so it needs to be a list? <bramus> chris: yes <bramus> emilio: dont know, maybe this should be in keyframes? <bramus> chris: that is part of the proposal <bramus> emilio: feels weird that this is color specific but property name does not give hint <bramus> chris: can put color in there <bramus> emilio: could be confused otherwise <bramus> +1 <bramus> emilio: other than that seems reasonable <Rossen_> ack emilio <bramus> chris: brian also added proposal for web animations in the issue <bramus> emilio: do we expect a lot of ppl setting this to anything other than oklab? <bramus> chris: that gets us in the whole webcompat issue <flackr> q- <bramus> chris: talking about an opt in <bramus> chris: oklab and oklch will be obvious choices <fserb> I think adding color to the name makes sense. (nit: Is it a problem to add "auto" on the shorthand?) <bramus> emilio: if you do color-mix with two oklab colors, they mix in oklab right? <bramus> chris: yes <bramus> emilio: (???)> <bramus> chris: doesnt matter how you specify the orig colors. you can mix in other spaces <bramus> emilio: maybe default should be oklab? <bramus> chris: would be nice, but people have existing content <bramus> emilio: maybe auto can do the right thing based on the defined colors? <bramus> chris: auto means that legacy srgb mix in srgb. non-legacy colors mix in oklab. <fserb> I think auto already does what emilio wants. <bramus> Rossen_: in terms of feature itself, do you agree emilio? then can sweat details. <flackr> q+ <bramus> emilio: seems reasonable, other than prop name <bramus> chris: agree <bramus> emilio: do we want to allow interpolationg different properties differently? <bramus> emilio: eg background-color and color <bramus> chris: i understand the requirement <bramus> chris: if its about the keyframes, it means it applies to all color interpolations. a separate vlaue for each one, would need a ton of new properties <Rossen_> ack flackr <bramus> flackr: could we specify this as part of the color? <flackr> q- <bramus> chris: we are not going to solve this in 5 minutes <bramus> Rossen_: good suggestion <bramus> fantasai: so proposal is to add both transition-interpolation and animation-interpolation, where you can put the last one in a keyframe too? <bramus> chris: yes <bramus> fantasai: we also hav esuggestion from emilio to do it per property <bramus> fantasai: this could be an addition? <bramus> flackr: would affect the syntax <bramus> emilio: need to know if we want this in the future <bramus> fantasai: two possible ways to go about it, is to incorporate it in the color (cfr. flackr) and another option is to do sth similar as we do with transition <bramus> chris: the latter seems like a better solution <bramus> chris: would like to see it written out <bramus> Rossen_: looks like this is expanding beyond orig proposal <bramus> Rossen_: lets take back to issue <bramus> chris: yes <fantasai> s/with transition/with transition, and list out the properties named e.g. animation-color-interpolation: oklab color background-color sRGB outline-color, ...; / <bramus> Rossen_: dont see issue we can tackle in 2 minutes … |
Assuming this property is list-valued, like all other transition/animation properties then it's already possible to use different color interpolation methods per property, at least for transitions. For animations it would be a little more involved, but still possible. Also, I think that's a bit of an edge case, not something to center the design around. As long as it's possible, it's fine. Agree with renaming to |
Well, this is not only related to transitions. It is also related to all sorts of compositing. Thus, an idea is to have a CSS
Supported values:
Notice that this only affects the interpretation of #808080, which will enter the rendering pipeline as roughly #404040. Blending and gradient rendering is still performed in linear space.' You would typically use {box-sizing: border-box;width: 100%;border: solid #5B6DCD 10px;padding: 5px;} Which I also highly recommend using. |
@milasudril Gradients have their own interpolation space, specified on the gradient itself. Also, compositing and interpolation are different use cases that often require different color spaces. Lastly, your proposal only covers sRGB (linear and gamma-encoded) which is not sufficient to cover most interpolation use cases, as neither of these are perceptually uniform spaces. Your example with |
@LeaVerou the idea behind |
@milasudril Please keep in mind that the Web and its use cases are fundamentally different from C++ rendering pipelines in a number of ways. This thread is about the relatively straightforward change of extending the control CSS already provides over interpolation color space to CSS transitions. If you want to change how color works in CSS as a whole, please open a new issue, provide use cases that justify such a substantial change, as well as a plan for backwards compat with existing web content. This issue is not the place for this discussion. |
Tying together how a color is specified and how it is manipulated like that is a design flaw. The current design carefully avoids that.
Cascading style sheets from different origins into one design is fundamentally at odds with the "change everything at once" model you are proposing. |
@LeaVerou Sure, that is a different topic, but I think that solving root causes, everything else would get a much cleaner solution. By the way, is suggesting a linear rendering mode for CSS, or is that to be discussed in a different forum? |
Some notes (
|
Sorry, on my phone so I might not have read up on the context properly, but two quick questions arose for me:
|
ProposalGiven that we now have Its syntax would then become:
It’s concerning that there is no |
That looks good to me. CSS Color 4 defines the |
As I followed up on #10469, if we go with this approach, we'll also need to define a corresponding property on the Web Animations API for these properties to map to (see my previous comment). |
Yup, that seems orthogonal though. Anything we come up with would require changes to the Web Animations API. |
Unless we decide to go with a |
That’s highly unlikely, since, as explained many times before, different use cases require different color interpolation settings. |
My apologies, I haven't seen that context. I had a think about this and I'm afraid I don't think The main issue is a layering one. We could still add a Furthermore, it would complicate using the Personally I think adding a very generic sounding All said, I think Lea's original suggestion of adding a separate animation interpolation properties (#7035) is preferable here and |
@birtles I get the distinction you’re drawing, but I worry it’s largely philosophical and not evident in the naming of I wonder if we can change the name of
Oh absolutely, that would be terrible ergonomics. It’s also unclear whether there are use cases for disabling discrete animations. If we were to go that route, I suspect |
@LeaVerou That's great that we're on the same page about not having to preserve However, I think there's still a fundamental layering issue with regards to repurposing Suppose we add UAs apply If we have: div {
text-wrap: wrap;
transition: all 1s;
transition-behavior: allow-discrete;
}
div:hover {
text-wrap: balance;
} Then when the div is hovered, we're going to generate a transition for the Suppose we spec that UAs set the generated This property would need to be mutable so authors can change the color interpolation mode but if you change However, it gets possibly more awkward when we consider where this property actually lives. Presumably, we want to be able to change the color interpolation space between pairs of values. That is, like @keyframes anim {
from {
animation-behavior: allow-discrete;
text-wrap: wrap;
}
50% {
text-wrap: balance;
}
to {
text-wrap: wrap;
}
} With that setup, however, making the transition disappear when Perhaps there are good solutions to all these issues but so far my impression is that |
( Spun out from #7035 )(similar to #7062)
Currently, all color transitions happen in gamma-encoded sRGB space. There is a need to preserve this as a default, for Web compat. However, CSS Color 4 defines a bunch of other color models, which exceed the very limited gamut of sRGB, and there is a need to add control of the color space used for interpolation which is currently unspecified:
As this is a common requirement, CSS Color 4 defines a
<color-interpolation-method>
token and associated color interpolation math; this has already been used in the grammar for `color-mix() in CSS Color 5 and in linear, radial and conic gradients in CSS Images 4.So this issue proposes to add a new property, initial value
auto
:transition-interpolation: [ auto | <color-interpolation-method> ]#
and also to add this to the
<single-transition>
shorthand. There is no ambiguity (unlike time) so it can go in any order in the shorthand.The text was updated successfully, but these errors were encountered: