Raxol.Themes (Raxol v2.0.1)

View Source

Theme management system for Raxol terminal.

This module handles theme loading, application, and management for the terminal emulator. It supports dynamic theme switching and plugin-based theme customization.

Summary

Functions

Applies a theme to the terminal.

Returns a specification to start this module under a supervisor.

Gets the currently active theme.

Lists all available themes.

Loads a theme from a file or predefined theme name.

Functions

apply_theme(theme)

Applies a theme to the terminal.

Parameters

  • theme: A theme map with the following structure:
    %{
      background: color,
      foreground: color,
      cursor: color,
      selection: color
    }

Colors can be:

  • Atoms: :default, :black, :red, etc.
  • RGB tuples: {255, 0, 0}
  • RGBA tuples: {255, 0, 0, 128}

Returns

  • :ok on success
  • {:error, reason} on failure

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_current_theme()

Gets the currently active theme.

Returns

The current theme map or nil if no theme is active.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

list_themes()

Lists all available themes.

Returns

A list of theme names that can be loaded.

load_theme(theme_identifier)

Loads a theme from a file or predefined theme name.

Parameters

  • theme_identifier: Either a file path or a predefined theme name

Returns

  • {:ok, theme} on success
  • {:error, reason} on failure

register_theme_callback(callback_module, callback_fun \\ :on_theme_change)

Registers a theme change callback.

Parameters

  • callback_module: Module that implements on_theme_change/1
  • callback_fun: Function name to call (default: :on_theme_change)

Returns

  • :ok on success

start_link(init_opts \\ [])