Skip to content

[css-values-5] *-interpolate() grammar can lead to confusing values #12348

Open
@kbabbitt

Description

@kbabbitt

Spun off from #6245 (comment).

For color interpolation, an author might specify:

background-color: color-interpolate(300px, 200px: red, 500px: green, 600px: blue);

To me, this is intuitive to read: 300px as the progress value, then a list of stops.

An author might also specify:

background-color: color-interpolate(300px in hsl, 200px: red, 500px: green, 600px: blue);

Reading "300px in hsl" without having yet wrapped my brain around the grammar threw me for a loop. It read to me like we were somehow supposed to convert 300px to hsl and use that as the progress value, which made no sense.

The current general form of the interpolation functions is:

*interpolate() = *interpolate( [ progress && global-options? ],
                               stop, [  between-options? , stop ]# )

So "300px in hsl" breaks down as a progress value of "300px" and a global option value of "in hsl".

Would it be worth separating the progress value and option value more clearly? We'd be trading away a little flexibility for a little readability; maybe it's worth it maybe not - what do folks think?

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