Built-in ("system") theme registry. Each system theme is a file in
./themes/*.json — the file is the theme; there is no theme without a
theme file. This module loads them (Vite / Vitest glob) into the ordered list
the app + picker consume. The generator (scripts/gen-accents.mjs) reads the
same folder via fs to emit the static styles/foundation/accents.css. User
themes (Phase 7) merge on top of these at runtime.
Theme-file shape:
{ id, label, swatch, dark: {accent, ink}, light: {accent, ink} }
where dark is the neon tone and light the pastel tone; ink is the
readable text colour on an accent-filled button. --accent-strong /
--accent-soft derive from --accent in CSS, so they aren't in the file.
- Description:
Built-in ("system") theme registry. Each system theme is a file in
./themes/*.json— the file is the theme; there is no theme without a theme file. This module loads them (Vite / Vitest glob) into the ordered list the app + picker consume. The generator (scripts/gen-accents.mjs) reads the same folder viafsto emit the staticstyles/foundation/accents.css. User themes (Phase 7) merge on top of these at runtime.Theme-file shape: { id, label, swatch, dark: {accent, ink}, light: {accent, ink} } where
darkis the neon tone andlightthe pastel tone;inkis the readable text colour on an accent-filled button.--accent-strong/--accent-softderive from--accentin CSS, so they aren't in the file.
- Source:
Members
(static, constant) ACCENT_IDS
- Description:
All valid built-in accent ids, in picker order.
- Source:
All valid built-in accent ids, in picker order.
(static, constant) DEFAULT_ACCENT
- Description:
Default accent id (the mint theme; matches the :root tokens in tokens.css).
- Source:
Default accent id (the mint theme; matches the :root tokens in tokens.css).
Methods
(static) normalizeAccent(id, extraIdsopt)
- Description:
Normalize an accent id to a valid one. Valid = a built-in id, or any id in
extraIds(the user-theme ids). Unknown ids fall back to the default.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
id |
string | ||
extraIds |
Array.<string> |
<optional> |
Extra valid ids (e.g. user-theme ids). |
Type Definitions
Accent
Properties:
| Name | Type | Description |
|---|---|---|
id |
string | Stable id used in |
label |
string | Human label for the picker. |
swatch |
string | Representative colour for the picker swatch. |
dark |
AccentTone | Neon tone for the dark base. |
light |
AccentTone | Pastel tone for the light base. |
Type:
- object
AccentTone
Properties:
| Name | Type | Description |
|---|---|---|
accent |
string | The accent fill colour. |
ink |
string | Readable text colour on top of |
Type:
- object