Skip to content

fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#44

Closed
KailasMahavarkar wants to merge 1 commit intomainfrom
fix/design-tokens-gotchas
Closed

fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#44
KailasMahavarkar wants to merge 1 commit intomainfrom
fix/design-tokens-gotchas

Conversation

@KailasMahavarkar
Copy link
Copy Markdown
Collaborator

Two production-critical gotchas added to the design-tokens plugin:

  1. @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.

  2. 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.

… 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.
@KailasMahavarkar KailasMahavarkar force-pushed the fix/design-tokens-gotchas branch from 96dfda5 to 2776a26 Compare April 11, 2026 09:55
@KailasMahavarkar KailasMahavarkar deleted the fix/design-tokens-gotchas branch April 11, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant