Re: [csswg-drafts] [css-color-4] Clarification on how `channel keywords` with multiple specified types work (#7876)

I think this is a case of the editors not appreciating the impact of other changes. At the time it was introduced to CSS, CIE L was a `<number>` in [0..100]. Then it became a mandatory `<percentage>` for a long time, and relatively recently became `<percentage>` | `<number>`. You are right that this means RCS no longer defines what you actually calculate with for `calc()` inside RCS.

Following the advice that @LeaVerou gives in her CSS Variables talks:

> converting a number to a value with units is easy, `calc(var(--foo) * 100%)` 
> converting a value with units to a number requires things like `calc(var(--foo) / 1%)` which don't exist yet
> so make your custom properties be pure data with no units

Then I suggest resolving this such that `<percentage>` gets resolved to `<number>` because that will be the most convenient thing to manipulate in `calc()`

So 
```css
--base: oklab(50% 0.2 -12%);
--darker: oklab(from var(--base) calc(l * 0.8) a b);
```

Using the [percent reference ranges for oklab](http://w3c.github.io/csswg-drafts/css-color-4/#specifying-oklab-oklch) the value of --base becomes `oklab(0.5 0.2 -0.048) and the value of --darker becomes `oklab(0.4 0.2 -0.048)'

Converting the `<percentage>` values to `<number>` is also consistent with [how those values are serialized](http://w3c.github.io/csswg-drafts/css-color-4/#serializing-oklab-oklch)

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


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

Received on Thursday, 13 October 2022 16:23:01 UTC