Skip to content

[css-transitions][css-animations][web-animations] Add control of colorspace used for transitioning colors #7063

Open
@svgeesus

Description

@svgeesus

( 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:

  • to avoid needless conversion to sRGB, dropping the more saturated colors
  • because interpolating in gamma-encoded space gives overly dark midpoint colors
  • because some color spaces give better results than others, which kind of varies depending what the start and end colors are, so stylesheet authors need the flexibility to choose.

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions