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

ccameron-chromium has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-hdr] Add interpolation between multiple values of dynamic-range-limit ==
This came up when [writing WPT tests](https://chromium-review.googlesource.com/c/chromium/src/+/5501416) for `dynamic-range-limit`.

The `dynamic-range-limit` [specification](https://drafts.csswg.org/css-color-hdr/#the-dynamic-range-limit-property) 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.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10271 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 30 April 2024 14:28:22 UTC