Skip to content

Commit f96c5ae

Browse files
docs(css): document dual-source CSS variable architecture
Explain why --destructive and other variables exist in both globals.css and themes.css: globals.css provides neutral fallback for "system" theme and pre-hydration, while themes.css overrides via higher specificity. Closes #153
1 parent 131cea7 commit f96c5ae

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/styles/globals.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
/**
22
* Global Styles
33
*
4-
* Define CSS Variables and global styles
5-
* Themes are managed with CSS Variables and can be switched from JavaScript
4+
* CSS Variable Architecture (dual-source design):
5+
*
6+
* 1. :root / .dark (this file)
7+
* shadcn/ui neutral defaults — achromatic, no hue.
8+
* Active when "system" theme is selected (no data-theme attribute).
9+
* Also serves as fallback before client hydration.
10+
*
11+
* 2. html[data-theme='xxx'] (themes.css)
12+
* 14 named themes with personality — warm/cool tinted OKLCH values.
13+
* Higher specificity (0,1,1) always overrides :root (0,1,0) when active.
14+
*
15+
* Some variables (e.g. --destructive) share the same value in both sources.
16+
* This is intentional — do NOT remove either definition.
617
*/
718
/*---break---
819
*/

src/styles/themes.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
/**
22
* Theme CSS Variables (14 Themes)
33
*
4-
* PRD 2.2 Design Tokens (14 Themes)
5-
* OKLCH-based color system with WCAG AA contrast compliance
4+
* PRD 2.2 Design Tokens — OKLCH-based color system with WCAG AA contrast compliance.
65
*
7-
* Light Themes: Default / Sunrise / Sandstone / Mint / Sky / Lavender / Rose
8-
* Dark Themes: Dark / Midnight / Graphite / Forest / Ocean / Plum / Rust
6+
* Light: Default / Sunrise / Sandstone / Mint / Sky / Lavender / Rose
7+
* Dark: Dark / Midnight / Graphite / Forest / Ocean / Plum / Rust
8+
*
9+
* These selectors (html[data-theme='xxx']) override the neutral :root/.dark
10+
* defaults in globals.css when a named theme is active.
11+
* When "system" theme is selected, no data-theme is set and globals.css
12+
* :root/.dark values are used instead (see globals.css header for details).
13+
*
14+
* Some variables (e.g. --destructive) intentionally share the same value
15+
* as globals.css. Update BOTH files when changing shared values.
916
*/
1017

1118
/* ============================================

0 commit comments

Comments
 (0)