You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`selector.kind` is one of `attribute` (with `name`, `value`, optional `host`), `class` (with `name`, optional `host`), `media` (with `media: '(prefers-color-scheme: dark)'`), or `default` (no selector — the base `:root` values). Apps with only one theme should emit a single `{ "id": "default", "name": "Default", "selector": { "kind": "default" } }` variant.
2.**Data-attribute theming** — If CSS contains `[data-theme="…"]`, `[data-bs-theme="…"]`, `[data-mui-color-scheme="…"]`, `[data-mantine-color-scheme="…"]`, or `[data-color-scheme="…"]` selectors. Emit one variant per distinct attribute value:
Set `defaultTheme` to the variant id used when no selector matches — typically `"light"` or `"default"`.
91
+
92
+
### 3. Scan colors
54
93
55
94
**Find color sources:**
56
95
57
-
1.**CSS variables**: Search for `:root`declarations across CSS files and Vue `<style>` blocks. Extract `--variable-name: value` pairs.
96
+
1.**CSS variables**: Search for `:root`, `:root.dark`, `html.dark`, `[data-theme="…"]`, and `@media (prefers-color-scheme: dark) :root`declarations across CSS files and Vue `<style>` blocks. Extract `--variable-name: value` pairs, remembering which variant scope each came from.
58
97
59
-
2.**Tailwind v4** (version >= 4): Search for `@theme` blocks in CSS files. Extract custom properties defined within them.
98
+
2.**Tailwind v4** (version >= 4): Search for `@theme` blocks in CSS files. Extract custom properties defined within them.`@theme` blocks without a variant selector apply to every variant.
60
99
61
100
3.**Tailwind v3** (version < 4): Read `tailwind.config.js`, `tailwind.config.ts`, or `tailwind.config.mjs`. Extract `theme.extend.colors`. Convert to flat key-value pairs.
62
101
102
+
**Resolve each color under every detected variant.** Produce a `values` map
103
+
keyed by theme id. When a variant doesn't override the token, copy the base
104
+
(`:root`/light/default) value so every token has a value for every variant.
105
+
When a variant-specific block defines a new CSS variable that doesn't appear
106
+
in the base scope, leave the missing variants blank (the server normalizer
107
+
will fill them when the spec is read).
108
+
63
109
**Classify into semantic roles using this fixed vocabulary:**
64
110
65
111
| Role | Match heuristics (in variable/key name) |
@@ -81,7 +127,11 @@ If a variable doesn't match any heuristic, use a descriptive role name derived f
81
127
82
128
**Limits**: Maximum 30 color tokens. Prioritize semantic roles first, then most-used custom colors.
83
129
84
-
### 3. Scan typography
130
+
### 4. Scan typography
131
+
132
+
Apply the same per-variant `values` map strategy used for colors: resolve each
133
+
token under every detected variant, copying the base value for variants that
134
+
don't override it.
85
135
86
136
**Font families**: Search for:
87
137
- CSS variables containing `font`, `family` in `:root` or `@theme`
@@ -102,7 +152,7 @@ Use roles: `xs`, `sm`, `base`, `lg`, `xl`, `2xl`, `3xl`, `4xl` (match by name or
102
152
103
153
**Weights**: Scan component files for `font-weight` values and Tailwind weight classes (`font-bold`, `font-semibold`, etc.). List unique weights as strings: `["400", "500", "600", "700"]`.
0 commit comments