Theme-file parse / validate / serialize. A theme file is the same shape as a built-in system theme (see gui/src/theme/themes/*.json):
{ id, label, swatch, dark: {accent, ink}, light: {accent, ink} }
optionally wrapped as { format:"rap-theme", version:1, theme:{...} }.
Import is strict + allow-listed: only the known fields are read, ids are constrained, and every colour must be a plain hex string. Nothing else is carried through — a theme file can never inject arbitrary CSS (the runtime applier builds the stylesheet from these validated primitives only).
- Description:
Theme-file parse / validate / serialize. A theme file is the same shape as a built-in system theme (see gui/src/theme/themes/*.json):
{ id, label, swatch, dark: {accent, ink}, light: {accent, ink} }
optionally wrapped as { format:"rap-theme", version:1, theme:{...} }.
Import is strict + allow-listed: only the known fields are read, ids are constrained, and every colour must be a plain hex string. Nothing else is carried through — a theme file can never inject arbitrary CSS (the runtime applier builds the stylesheet from these validated primitives only).
- Source:
Methods
(static) parseThemeFile(input) → {Object|Object}
- Description:
Parse + validate a theme file (a JSON string or an already-parsed object).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
input |
string | object |
Returns:
- Type
- Object | Object
(static) serializeTheme(theme) → {string}
- Description:
Serialize a theme to a downloadable, versioned theme file (pretty JSON).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
theme |
object |
Returns:
- Type
- string