Re: [csswg-drafts] [css-color-5] Hue interpolation and multiple colors (#5277)

Hi @svgeesus

> _"...In linear-light colorspaces, I think additivity also means that we can do pairwise combination in any order:..."_

**YES, at least in part.** 
- Assuming the space is essentially unbounded (linearized _should_ be 16bit float+ with no clamps)
- PEMDAS, regular mathematical order of operations DO apply.
- compound/complex/non-reversable blend operations are still order specific in most cases.

For linear tristimulus color models, if color-mix() *only* uses plain addition, then order does not matter. If after addition, there is an averaging, then order does not matter **for n-colors being mixed at the same time that are to be averaged at the same time** but otherwise mathematical order of operations always applies. However, a key reason to work in a linear-space is to not have to do any averaging at all, just add 'em up. 

Order can matter when the blend operations are more complex, like overlay, screen. If you add two colors, and average, then add another and average, order matters regardless of TRC, because that is a PEMDAS issue.

Some gamma encoded tristimulus additive spaces are also not necessarily order specific, except if there are overflow issues. That is, you can add three sRGB colors together in any order and average them after adding all three. Again, PEMDAS applies, but so does overflow or clipping.

I wrote a brief in #4711  regarding recursively mixing pairs only, which on further reading I see @una had already suggested. The post provides additional support for the concept.

## Parting Thought on Multicolor Mixing

I say keep it to color pairs, and allow recursive/iterative mixing. **BUT** 

It would be useful to add one utility feature:

### Shade/Tint/Tone

Keep it to a pair of colors, but allow the addition of an achromatic modifier, from ` #00 to #ff ` OR perhaps it should be -128 to 127, to be added to the mix as an auxiliary additive input but (probably?) **does not change the averaging percentages** of the two main colors. 

I'd say it should be the last of the parameters.

color-mix( orange 35%, cyan, -64)

Which if any of the color parameters the achromatic modifier is applied to depends on the space. It's applied to all three channels in a tristimulus space, but only L* C* in an LCh mode for instance (where it _subtracts_ from C*), and maybe only L* in LAB.




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


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

Received on Monday, 1 March 2021 05:20:38 UTC