Registry and preset repository for UI semantic themes.
Includes 16 calibrated presets, JSON serialization/deserialization for custom user themes,
reactive on_change subscription hooks, and accessibility contrast auditing.
Class methods
all
Returns all registered themes.
Sourceclear_listeners
Clears all change listeners
SourceCalculates WCAG 2.1 contrast ratios for key UI color pairings in a theme.
Sourcecurrent
Returns the currently active global theme.
SourceSets the currently active global theme and notifies subscribers.
Sourceexport_json(theme :
Theme) :
String Exports a theme to a JSON string representation.
Sourceexport_kv(theme :
Theme) :
String Exports a theme to a clean, human-readable key-value (.theme) string.
SourceFetches a theme by name, falling back to catppuccin_mocha or default.
SourceChecks if a theme exists by name.
Sourceimport_json(json_str :
String) :
Theme Imports a theme from a JSON string representation.
Sourceimport_kv(kv_str :
String) :
Theme Imports a theme from a key-value (.theme) string representation.
Sourceload_file(path :
String) :
Theme Loads a theme from either a JSON (.json) or key-value (.theme) file.
Sourcenames
Returns names of all registered themes.
Sourceon_change
Registers a listener callback invoked whenever the active theme changes.
Sourceregister(theme : Theme) : Theme
Registers a theme in the store.
Sourcesave_file(theme :
Theme, path :
String) :
Nil Saves a theme to a file on disk (auto-detects JSON or KV based on file extension).
Source