Skip to content

[css-color-hdr] Add interpolation between multiple values of dynamic-range-limit #10271

Closed
@ccameron-chromium

Description

@ccameron-chromium

This came up when writing WPT tests for dynamic-range-limit.

The dynamic-range-limit specification allows for interpolation between two dynamic-range-limit values by the dynamic-range-limit-mix function. It was pointed out that interpolation between multiple different values may happen implicitly during animation.

The syntax chosen in the spec lends itself to fixing this issue fairly simply. The current syntax is

  dynamic-range-limit-mix() = dynamic-range-limit-mix( [ <ident> && <percentage [0,100]>? ]#{2})

The suggestion that I was given was to change this to

  dynamic-range-limit-mix() = dynamic-range-limit-mix( [ <ident> && <percentage [0,100]> ]+)

Example: Halfway between standard and high.

  dynamic-range-limit-mix(standard 50%, high 50%)

This is the same as the existing syntax.

Example: One-fifth between constrained-high and dynamic-range-limit-mix(standard 40%, high 60%):

  dynamic-range-limit-mix(constrained-high 20%,  dynamic-range-limit-mix(standard 40%, high 60%) 80%)

this simplifies to

  dynamic-range-limit-mix(standard 32%, high 48%, constrained-high 20%)

Notes

In the syntax we didn't allow percentages to be omitted (cause it can get a bit difficult to define more than one unspecified value, unlike color-mix which has natural definitions).

If the sum of the arguments' percentages is 0%, then the function fails.

The arguments' percentages are normalized so that they add to 100%.

The percent for standard, high, and constrained-high is computed as the of the weighted sum of its percents in each argument.

I'll try to put together a patch that does this.

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