Repository navigation
Unescape theme keys in the color-mix(…) polyfill - #20735
RobinMalfait wants to merge 1 commit into
Conversation
The value parser keeps CSS escapes in variable names, e.g. `--color-brand\.light`, but the theme stores its keys unescaped. The lookup missed, and the fallback before `@supports (color: color-mix(…))` lost its opacity.
[Low impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "Unescape theme keys in the `color-mix(…)..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review. WalkthroughThe color-mix fallback resolver now unescapes CSS variable names before looking them up in the theme. A regression test covers opacity utilities with escaped-dot theme keys, including a key that references another key. The changelog records the fix. Merge Risk:
|
This PR fixes the
color-mix(…)polyfill for theme colors with escaped characters in their name.The polyfill looks up the variable of a
var(…)in the theme to inline its color in the fallback. The value parser keeps CSS escapes in the variable name (e.g.--color-brand\.light), but the theme stores its keys unescaped (--color-brand.light). So the lookup missed, and the fallback lost its opacity:text-brand.light/50generated:Now it generates:
The fix unescapes the variable name before the lookup, as
Theme#markUsedVariableandTheme#getOptionsalready do.Conflict with #20606
#20606 changes the same line, to
designSystem.theme.unprefixKey(variableName). Whichever PR merges second has a small conflict there. The final form is:Test plan
--color-brand\.lightand--color-1\.5: var(--color-brand\.light), which also covers an escaped name in a nestedvar(…). It fails without the fix.pnpm vitest runinpackages/tailwindcsspasses.