Skip to content

smelt.theme

Tier: UiHost — Requires a terminal UI; calling these from headless mode raises.

Apply, read, and override the active colorscheme. Highlight groups follow nvim's PascalCase convention (Comment, SmeltAccent, …). The full colorscheme is described by a ThemeSpec table whose groups map keys are highlight-group names and whose values are either a StyleDecl table or a string referencing another group in the spec. UiHost-only.

smelt.theme.apply

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

Types: smelt.theme.ThemeSpec

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

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

smelt.theme.is_light

fun(): boolean

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

smelt.theme.set

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

Types: smelt.theme.StyleDecl

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

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

smelt.theme.use

fun(name: string): nil

Load colorscheme name from runtime/lua/smelt/colorschemes/<name>.lua and apply it. The file must return a ThemeSpec table: a groups map keyed by highlight-group name with either a StyleDecl table or a string reference as its value (see smelt.theme.apply). Drop custom colorschemes alongside default.lua.