Theme helpers for semantic Breeze color tokens.
Themes can be:
:system16for legacy ANSI-slot-based themes:systemfor richer themes derived from the terminal palette when available- custom maps/keywords/structs with explicit defaults, palette entries, and extras
Theme variables
Color classes such as text-primary, bg-panel, border-warning,
scrollbar-muted, and placeholder-text-muted resolve their suffix through
the active theme. Inline style values such as %{foreground_color: :primary}
use the same lookup.
Every built-in theme provides these default variables:
| Variable | Aliases | Intended use |
|---|---|---|
text | fg, foreground_color | Default foreground text |
background | bg, background_color | Default application background |
border | stroke, border_color | Default border and outline color |
The bare text and bg classes select the default text and background
colors. The aliases can also be used as suffixes, such as text-fg or
bg-bg.
Every built-in theme also provides this semantic palette:
| Variable | Intended use |
|---|---|
muted | Secondary text, subdued borders, and low-emphasis content |
primary | Primary actions, active controls, and prominent highlights |
secondary | Supporting actions and alternate highlights |
warning | Cautionary states that need attention |
error | Errors, failures, and destructive actions |
success | Successful and positive states |
accent | Selection, emphasis, and decorative highlights |
surface | Raised or subtly separated surfaces |
panel | Panels, dialogs, and stronger container backgrounds |
Built-in themes define cursor as an extra variable for text input and
textarea cursors. Inputs fall back to accent when a custom theme does not
provide it.
Custom themes can override the standard variables and add any number of
application-specific variables through extras:
Breeze.Theme.new(
name: "brand",
defaults: %{
text: "#E8EEF7",
background: "#10151D",
border: "#52606D"
},
palette: %{
muted: "#9AA5B1",
primary: "#4DA3FF",
secondary: "#9B8AFB",
warning: "#F7C948",
error: "#EF4E4E",
success: "#3EBD93",
accent: "#F970C7",
surface: "#1B2430",
panel: "#253244"
},
extras: %{cursor: "#FFFFFF", brand: "#4DA3FF"}
)The custom brand variable is then available as text-brand, bg-brand,
border-brand, and anywhere else Breeze resolves a color.
The variables field on %Breeze.Theme{} stores runtime theme metadata; it
is not part of semantic color lookup. Named colors are resolved from
defaults, palette, and extras, in that order.
Built-in themes
Pass these names to builtin/2:
:nebula:catppuccinor:catppuccinwith the:darkvariant:dracula:gruvboxor:gruvboxwith the:darkvariant:nord:solarizedwith either the:lightor:darkvariant:solarized_lightand:solarized_darkas variant aliases
Summary
Types
A terminal color index, RGB tuple, or color string.
An RGB color tuple.
A normalized Breeze theme.
Colors reported by a terminal palette probe.
Functions
Blends two colors using a weight clamped between 0.0 and 1.0.
Returns whether a theme supports RGB color blending.
Returns a built-in theme.
Returns a named default, palette, or extra color from a theme.
Darkens a color by blending it toward black.
Returns the default system-16 theme.
Returns the built-in theme names in their standard cycling order.
Returns the default style map for a theme input.
Returns whether a theme input enables theme-provided default styles.
Ensures an asynchronous terminal-palette probe is running.
Stores a completed runtime palette and returns its availability status.
Lightens a color by blending it toward white.
Merges terminal response data into an in-progress palette probe.
Normalizes a theme name, map, keyword list, or struct into a theme.
Returns the theme after current in a cycle, wrapping at the end.
Restores :system as the source for a system theme using a fallback palette.
Returns the terminal-palette probe status recorded by a theme.
Returns whether a theme input requests the terminal-derived system theme.
Resolves a semantic color name while preserving literal color values.
Resolves a built-in name or {name, theme} entry into a named theme tuple.
Returns whether a palette probe has collected all required colors.
Returns the terminal-palette probe timeout in milliseconds.
Starts a terminal-palette probe and returns its initial state.
Builds a theme from the terminal's standard 16-color palette.
Builds a theme from the terminal palette.
Types
@type color() :: non_neg_integer() | rgb() | String.t()
A terminal color index, RGB tuple, or color string.
@type rgb() :: {0..255, 0..255, 0..255}
An RGB color tuple.
@type t() :: %Breeze.Theme{ dark: boolean() | nil, defaults: %{optional(atom()) => color()}, extras: %{optional(atom()) => color()}, mode: :custom | :system | :system16, name: String.t() | nil, palette: %{optional(atom()) => color()}, terminal_palette: terminal_palette() | nil, variables: %{optional(String.t()) => term()} }
A normalized Breeze theme.
Colors reported by a terminal palette probe.
Functions
Blends two colors using a weight clamped between 0.0 and 1.0.
Returns whether a theme supports RGB color blending.
Returns a built-in theme.
The available themes are:
:nebula:catppuccinor:catppuccinwith the:darkvariant:dracula:gruvboxor:gruvboxwith the:darkvariant:nord:solarizedwith either the:lightor:darkvariant:solarized_lightand:solarized_darkas variant aliases
Examples
Breeze.Theme.builtin(:nebula)
Breeze.Theme.builtin(:solarized, :light)
Returns a named default, palette, or extra color from a theme.
Darkens a color by blending it toward black.
Returns the default system-16 theme.
@spec default_cycle() :: [atom()]
Returns the built-in theme names in their standard cycling order.
Returns the default style map for a theme input.
Returns whether a theme input enables theme-provided default styles.
@spec ensure_runtime_palette_async( %Termite.Terminal{adapter: term(), reader: term(), size: term()} | nil, pid() ) :: :ok
Ensures an asynchronous terminal-palette probe is running.
@spec finish_runtime_palette_probe( %Termite.Terminal{adapter: term(), reader: term(), size: term()} | nil, map() ) :: :ready | :unavailable
Stores a completed runtime palette and returns its availability status.
Lightens a color by blending it toward white.
Merges terminal response data into an in-progress palette probe.
Normalizes a theme name, map, keyword list, or struct into a theme.
Returns the theme after current in a cycle, wrapping at the end.
Restores :system as the source for a system theme using a fallback palette.
@spec probe_status(t() | map() | keyword() | atom() | nil) :: :ready | :pending | :unavailable | nil
Returns the terminal-palette probe status recorded by a theme.
Returns whether a theme input requests the terminal-derived system theme.
Resolves a semantic color name while preserving literal color values.
Resolves a built-in name or {name, theme} entry into a named theme tuple.
Returns whether a palette probe has collected all required colors.
@spec runtime_palette_probe_timeout_ms() :: pos_integer()
Returns the terminal-palette probe timeout in milliseconds.
@spec start_runtime_palette_probe( %Termite.Terminal{adapter: term(), reader: term(), size: term()} | nil ) :: {:start, term(), binary()} | :ready | :pending | :unavailable | :error
Starts a terminal-palette probe and returns its initial state.
Builds a theme from the terminal's standard 16-color palette.
Builds a theme from the terminal palette.
Falls back to system16/1 while retaining the system-theme request when a
complete palette is not yet available.