Re: [csswg-drafts] [css-color-5] `light-dark()` should resolve at used value time, not computed value time (#13836)

> As an author, at least partially due to this I've resorted to not store my tokens in CSS variables at all and use Sass variables instead to inline the expressions at build time.

I'm not entirely certain what benefit you think you're getting from doing this. Using a preprocessor resolves the variables before parse time, which is *even earlier* than computed-value time.

> [Or would if() have the same issue?](https://drafts.csswg.org/css-conditional-values-1/#condition-computed-value)

Yes, it would - `if()`, like all arbitrary-substitution functions, is resolved away at computed-value time, so if you're using color-scheme tests they'll resolve based on that element's scheme and then inherit as the decided-upon value.

> If I set an inheritable property like color on an element, I expect that value to inherit into the descendents' text nodes. And I made that happen; I set those values. I feel in control as the author and told the browser engine to do that.

Right, you expect the color you set to inherit. You don't necessarily expect the *expression* you used to inherit and re-calculate in the new context. Setting color and background together as a pair is a best practice, but only one of those inherits, so if the colors change after inheritance, it only changes one of the pair. We shouldn't be defaulting authors into something inaccessible.

That is, if you *manually* set just `color` on the child element in Emilio's example, it would definitely become inaccessible (white on white), but that's *because* you didn't set color and background as a pair. That's an easy reflex to train yourself into catching. Having it happen automatically (and without any recourse) wouldn't be great.

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


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

Received on Tuesday, 12 May 2026 22:28:35 UTC