class

Opal::ThemeStore

Inherits Reference < Object

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.

Source
clear_listeners

Clears all change listeners

Source
contrast_analysis(theme : Theme) : Hash(String, Float64)

Calculates WCAG 2.1 contrast ratios for key UI color pairings in a theme.

Source
current

Returns the currently active global theme.

Source
current=(theme : Theme | Symbol | String) : Theme

Sets the currently active global theme and notifies subscribers.

Source
export_json(theme : Theme) : String

Exports a theme to a JSON string representation.

Source
export_kv(theme : Theme) : String

Exports a theme to a clean, human-readable key-value (.theme) string.

Source
get(name : Symbol | String) : Theme

Fetches a theme by name, falling back to catppuccin_mocha or default.

Source
has?(name : Symbol | String) : Bool

Checks if a theme exists by name.

Source
import_json(json_str : String) : Theme

Imports a theme from a JSON string representation.

Source
import_kv(kv_str : String) : Theme

Imports a theme from a key-value (.theme) string representation.

Source
load_file(path : String) : Theme

Loads a theme from either a JSON (.json) or key-value (.theme) file.

Source
names

Returns names of all registered themes.

Source
on_change

Registers a listener callback invoked whenever the active theme changes.

Source
register(theme : Theme) : Theme

Registers a theme in the store.

Source
save_file(theme : Theme, path : String) : Nil

Saves a theme to a file on disk (auto-detects JSON or KV based on file extension).

Source