Raxol.UI.Theming.ThemeBehaviour behaviour (Raxol v0.4.0)

View Source

Defines the behaviour for Theme services.

Summary

Callbacks

Applies a theme to an element tree.

Gets a color from a theme.

Gets a component style from a theme.

Gets the dark theme.

Gets the default theme.

Gets a theme by ID.

Gets a color value considering the theme and an optional variant.

Initializes the theme system.

Lists all registered themes.

Registers a theme.

Types

theme_t()

@type theme_t() :: Raxol.UI.Theming.Theme.t()

Callbacks

apply_theme(element, theme)

@callback apply_theme(element :: map() | [map()], theme :: theme_t()) :: map() | [map()]

Applies a theme to an element tree.

color(theme, color_name)

@callback color(theme :: theme_t(), color_name :: atom()) :: any()

Gets a color from a theme.

component_style(theme, component_type)

@callback component_style(theme :: theme_t(), component_type :: atom()) :: map()

Gets a component style from a theme.

dark_theme()

@callback dark_theme() :: theme_t()

Gets the dark theme.

default_theme()

@callback default_theme() :: theme_t()

Gets the default theme.

get(theme_id)

@callback get(theme_id :: atom()) :: theme_t() | nil

Gets a theme by ID.

get_color(theme, color_name, variant_id)

@callback get_color(
  theme :: theme_t(),
  color_name :: atom(),
  variant_id :: atom() | nil
) :: any()

Gets a color value considering the theme and an optional variant.

init()

@callback init() :: :ok

Initializes the theme system.

list()

@callback list() :: [theme_t()]

Lists all registered themes.

register(theme)

@callback register(theme :: theme_t()) :: :ok

Registers a theme.