Manages terminal themes with advanced features:
- Theme loading from files and presets
- Theme customization and modification
- Dynamic theme switching
- Theme persistence and state management
Unified Theme System
Themes are sourced from Raxol.Core.Theming.ThemeRegistry, which
provides a single source of truth for all Raxol themes. Use
load_from_registry/2 to load any registered theme.
Usage
manager = Raxol.Terminal.Theme.Manager.new()
# Load a theme from the unified registry
{:ok, manager} = Raxol.Terminal.Theme.Manager.load_from_registry(manager, :dracula)
# Get a style
{:ok, style, manager} = Raxol.Terminal.Theme.Manager.get_style(manager, :normal)
Summary
Functions
Adds a custom style to the current theme.
Gets the current theme metrics.
Gets a style from the current theme or custom styles.
Lists all themes available in the unified registry.
Loads a theme from the unified theme registry.
Loads a theme from a file or preset.
Creates a new theme manager with the given options.
Restores a theme state from saved data.
Saves the current theme state for persistence.
Types
@type theme() :: %{ name: String.t(), description: String.t(), author: String.t(), version: String.t(), colors: %{ background: color(), foreground: color(), cursor: color(), selection: color(), black: color(), red: color(), green: color(), yellow: color(), blue: color(), magenta: color(), cyan: color(), white: color(), bright_black: color(), bright_red: color(), bright_green: color(), bright_yellow: color(), bright_blue: color(), bright_magenta: color(), bright_cyan: color(), bright_white: color() }, styles: %{ normal: style(), bold: style(), italic: style(), underline: style(), cursor: style(), selection: style() } }
Functions
Adds a custom style to the current theme.
Gets the current theme metrics.
Gets a style from the current theme or custom styles.
@spec list_registry_themes() :: [atom()]
Lists all themes available in the unified registry.
Loads a theme from the unified theme registry.
This is the preferred way to load themes as it uses the single source of truth for all Raxol theme definitions.
Examples
{:ok, manager} = Manager.load_from_registry(manager, :dracula)
{:ok, manager} = Manager.load_from_registry(manager, :synthwave84)
Loads a theme from a file or preset.
Creates a new theme manager with the given options.
Restores a theme state from saved data.
Saves the current theme state for persistence.