Re: [csswg-drafts] [css-color-5] How should missing (`none`) components work with calc() on named components in the relative color syntax (#6920)

> There is no "other color" here so we have lab(0% 0 0) and 0 / 2 = 0

There is a small argument for having some way to preserve the "missing" concept into `calc()` so that users could match the interpolation rules the engine uses in a custom interpolation they might implement using the relative color syntax:

```css
lab(from var(--my-color) 
            calc((1 - var(--progress-l)) * l + (var(--progress-l) * var(--other-color-l))
            calc((1 - var(--progress-a)) * a + (var(--progress-a) * var(--other-color-a))
            calc((1 - var(--progress-b)) * b + (var(--progress-b) * var(--other-color-b)) );
``` 

In the above, if one of the components was 'none', what the user probably really wanted was to just the other component, but if they always lose that information they are out of luck.

Admittedly, this example seems a bit far fetched and would probably require some new functionality in calc to conditionally do the behavior wanted, but I thought I would call it out in case you had any interesting ideas here. (Unrelated, should calc() have a `lerp()` builtin :) ?)

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


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

Received on Friday, 31 December 2021 17:48:11 UTC