Skip to content

smelt.theme

Availability: Some functions need the terminal UI; each function below says which.

List bundled colorschemes, or apply, read, and override the active one. Highlight groups follow nvim's PascalCase convention (Comment, SmeltAccent, …). A ThemeSpec has optional name, syntax, and light metadata plus a required groups map. Catalog and active-theme metadata reads are Host-tier; highlight-group access and mutations require UiHost.

smelt.theme.apply

fun(spec: smelt.theme.ThemeSpec): nil

Types: smelt.theme.ThemeSpec

Availability: Terminal UI only; raises in headless mode.

Compile spec against the current light/dark setting and install it as the active theme. String-valued group entries are resolved at compile time; cycles and dangling references raise a runtime error.

smelt.theme.get

fun(group: string): table

Availability: Terminal UI only; raises in headless mode.

Read the resolved StyleDecl for group. Unknown groups resolve to an empty table.

smelt.theme.info

fun(name: string): table?

Availability: Everywhere, including headless mode.

Return metadata for a built-in colorscheme by display name or module slug.

smelt.theme.is_light

fun(): boolean

Availability: Everywhere, including headless mode.

Return true if the active theme is a light theme. Lets plugins flip glyphs or contrast levels based on the current palette.

smelt.theme.list

fun(): table[]

Availability: Everywhere, including headless mode.

Return built-in colorschemes as { name, module, syntax, light, detail? } rows.

smelt.theme.set

fun(group: string, style: smelt.theme.StyleDecl): nil

Types: smelt.theme.StyleDecl

Availability: Terminal UI only; raises in headless mode.

Override a single highlight group's style. style is a StyleDecl table ({ fg = { ansi = 244 }, bold = true }). The override sticks until the next apply() or use() call.

smelt.theme.snapshot

fun(): table

Availability: Terminal UI only; raises in headless mode.

Snapshot every group currently set on the active theme into a { group = StyleDecl } table.

smelt.theme.syntax_theme

fun(): string?

Availability: Everywhere, including headless mode.

Return the active bundled syntect/two-face syntax theme name, if the colorscheme set one.

smelt.theme.syntax_theme_names

fun(): table

Availability: Everywhere, including headless mode.

Return all bundled syntect/two-face syntax theme names accepted by ThemeSpec.syntax.

smelt.theme.use

fun(name: string): nil

Availability: Terminal UI only; raises in headless mode.

Load colorscheme name from runtime/lua/smelt/colorschemes/<name>.lua and apply it. name may be either a module slug (catppuccin-mocha) or the display syntax theme name (Catppuccin Mocha).