Allow partial token replacements without resetting all theme variables with ScopedTheme #422
Closed
brunowilliang
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
|
Hi, to answer your question directly: we do not currently support extended or partial themes. Right now, Uniwind strictly enforces that all themes have the exact same variable set to guarantee predictable switching and prevent missing-token errors at runtime. It's definitely a pain point to duplicate all those tokens, but I'm not sure what "inherit all other tokens" should actually do.
If we just fall back to the "previous" theme in the tree, things could get unpredictable depending on where the ScopedTheme is placed. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
I am using
ScopedThemeand custom themes for page branding.I need to keep base
light/darkbehavior, but override only two tokens in scoped templates:--accent--secondaryCurrent behavior
When I define templates with partial overrides, Uniwind requires every theme to include the full variable set and throws:
Uniwind Error - Theme <template> is missing variable ...Uniwind Error - All themes must have the same variablesSo for small branding changes (2 colors), I currently need to duplicate dozens of tokens in every template.
Repro setup (simplified)
metro.config.jsglobal.css(intended partial overrides)Usage
Expected behavior
Scoped themes should support partial token overrides and fallback/inherit missing tokens from the active base theme (
lightordark), instead of requiring full token duplication.Possible approaches:
custom-templateextendslight/dark)ScopedThemeAPI for CSS variable overrides (subtree-level)Why this matters
For multi-tenant/page-branding scenarios, changing only
accentandsecondaryis common.Requiring full token duplication for each template is hard to maintain and error-prone.
Is there a recommended way to implement this today?
Beta Was this translation helpful? Give feedback.
All reactions