Alaja.Syntax.Theme (Alaja v2.3.0)

Copy Markdown View Source

Global syntax highlighting theme.

Maps token types to {color, [effects]} pairs. Colors are resolved through Pote's theme system, so they accept atoms, hex strings, or "theme:<key>" strings.

When rendering, the lookup order is:

  1. Language-level colors (lang.colors)
  2. Global Syntax.Theme
  3. Hardcoded defaults

Example

%Theme{
  name: "dracula",
  colors: %{
    keyword:  {:pink,    [:bold]},
    string:   {:yellow,  []},
    comment:  {:cyan,    [:italic]},
    number:   {:purple,  []}
  }
}

Summary

Functions

Returns the default theme with hardcoded fallback colors.

Resolves a token type's color and effects through a theme chain.

Types

t()

@type t() :: %Alaja.Syntax.Theme{colors: map(), name: String.t()}

Functions

default()

Returns the default theme with hardcoded fallback colors.

resolve(token_type, lang_colors, global_theme)

Resolves a token type's color and effects through a theme chain.