fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#44
Closed
KailasMahavarkar wants to merge 1 commit intomainfrom
Closed
fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#44KailasMahavarkar wants to merge 1 commit intomainfrom
KailasMahavarkar wants to merge 1 commit intomainfrom
Conversation
… mode inversion - @theme generates Tailwind utilities, NOT CSS custom properties on :root. If :root references var() values only defined in @theme, they resolve to undefined at runtime — all text/backgrounds go white. - Before refactoring a site's color system, verify its existing aesthetic direction. Dark-first sites break if :root is set to light values.
96dfda5 to
2776a26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two production-critical gotchas added to the design-tokens plugin:
@theme does NOT emit CSS custom properties on :root — If :root uses var(--color-brand-400) and that value is only defined in @theme, the var() resolves to undefined at runtime, making all text/backgrounds white. The correct architecture is raw OKLCH values directly on :root and .dark, with @theme inline bridging them.
Respect the existing aesthetic direction before inverting defaults — If a codebase uses dark backgrounds (charcoal-800, charcoal-900) with light text (offwhite, white/60) everywhere, dark IS the default. Setting :root to light values breaks 90% of text until every component is migrated.