Re: [csswg-drafts] Addition of `<color>` is way underspecified. (#8576)

For the example given in the original post, the results would be:

**1. (colors add in premultiplied oklab)**


because

 - `color(display-p3 0.3 0.6 0.2 / 0.5);` is `oklab(0.603 -0.15 0.118 / 0.5)` which when premultiplied is `[0.3015, -0.075, 0.509]'
 - `oklch(0.5 0.2 140)` is `oklab(0.5 -0.15 0.129)` which is the same when premultiplied `[0.5, -0.15, 0.129]`
 - add oklab components: `[0.8015, -0.225, 0.638]`

but wait, if I was interpolating then I would interpolate the alpha. But I am adding so do I add them? Interpolate them?
_Not clear how to un-premultiply here_ and [8.1.1. Combination of `<color>`](https://drafts.csswg.org/css-values-4/#combine-colors) doesn't say, even for sRGB.

@tabatkins any clues? I guess that adding `rgba(32, 64, 128, 50%)` and `rgba(128, 64, 32, 50%)` produces 50% alpha not 100% right?

**2. specify that colors do not add**

`color(display-p3 0.3 0.6 0.2 / 0.5);`

because V&U 4 Combining Values: Interpolation, Addition, and Accumulation [says](https://drafts.csswg.org/css-values-4/#combining-values)

> If a value type does not define a specific procedure for [addition](https://drafts.csswg.org/css-values-4/#addition) or is defined as not additive, its addition operation is simply V<sub>result</sub> = V<sub>a</sub>.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8576#issuecomment-1499606222 using your GitHub account


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

Received on Thursday, 6 April 2023 20:49:50 UTC