-
Notifications
You must be signed in to change notification settings - Fork 756
Description
Thinking about the proposal for animating font-palette in #8922, the question I had in mind was, why not allow to animate the different colors individually?
The main benefit of that is that you can transition each color individually and with that also define the interpolation color space. And besides the transition/animation use case, you'd be able to change each color on usage. That would require a new property to access and overwrite the colors outside of @font-palette-values, e.g. called font-palette-color.
Syntax suggestion:
font-palette-color: [ <integer [0,∞]> [ <absolute-color-base> | from-palette ] ]#So it would basically work like the override-colors descriptor descriptor but may also use the color from the palette via the from-palette keyword.
Example for an animation:
@keyframes --palette-animation {
from {
font-palette-color:
1 red,
2 from-palette
3 oklch(0.63 0.12 105.7);
}
to {
font-palette-color:
1 blue,
2 hsl(80 90% 60%),
3 oklch(0.5 0.90 185.7);
}
}One open question is what to do with colors not defined in font-palette-color and font-palette itself is not animated. Possible solutions I can think of:
- Use the colors from the palettes and
- interpolate them like other colors
- interpolate them discretely
- Use a default color like
currentcolor(that might also be overwritten by allowing to define a color without index, e.g.font-palette-color: black, 2 blue;would set the second color toblueand the rest of the colors in the palette toblack)
Initially, I wanted to add that as a comment to #8922, though as it covers additional use cases besides animation and is orthogonal to the proposal there, I thought it would be worth to discuss this separately.
Sebastian