packages/themes/README.md
Theme engine utilities for Nuclear. Tailwind v4 consumes CSS custom properties from @nuclearplayer/tailwind-config/global.css. All runtime theming is done by swapping CSS variables; no tokens are duplicated in TS.
data-theme-id on :root.<style id="advanced-theme">.[data-theme='dark'].listBasicThemes() → built-in themes metadatasetBasicTheme(id) → sets data-theme-id on documentElementapplyAdvancedTheme(theme) → validates and injects CSS for vars/darkclearAdvancedTheme() → removes the injected style tagBuilt-in basic theme IDs are namespaced with nuclear: to avoid collisions.
{
"version": 1,
"name": "My Theme",
"vars": { "background": "oklch(...)" },
"dark": { "background": "oklch(...)" }
}
Keys correspond to CSS var names without the leading --.
Snapshot tests assert the generated CSS is stable. This package avoids any non-CSS source of truth for theme values.