Documentation
¶
Overview ¶
Package theme provides colour palettes extracted from Chroma's styles as plain data, so both the full and lite builds can theme the whole UI (and the built-in highlighter) from any Chroma style name without importing Chroma.
The palette table in palettes_gen.go is produced by `go generate ./internal/theme` (see gen/main.go), which reads Chroma's style registry at generation time. The generated file holds only colour strings — no Chroma dependency — so it links into the lite build too.
Index ¶
Constants ¶
const DefaultName = "nord"
DefaultName is the theme used when none is configured, and the palette every other lookup falls back to. Both the UI (internal/ui) and the source highlighter (internal/syntax) resolve against it, so it lives here rather than as a constant duplicated in each.
Variables ¶
This section is empty.
Functions ¶
func ForegroundFor ¶
ForegroundFor returns the default text colour of a style, falling back to DefaultName's and then to "". Callers use it to colour tokens a style leaves unstyled.
Types ¶
type Palette ¶
type Palette struct {
Background string // editor background
Foreground string // default text
Comment string // comments, dim/secondary text
Keyword string // keywords, instruction mnemonics
Type string // type keywords
Function string // function/definition names
Name string // identifiers, registers
String string // string literals
Number string // numeric literals, immediates
Operator string // operators / punctuation
Error string // errors / "bad" highlights
}
Palette is the small set of semantic colours we pull from a Chroma style and map onto the UI and the built-in syntax highlighter. Every field is a #RRGGBB hex string; empty means the style didn't define it (callers fall back to Foreground).
func PaletteFor ¶
PaletteFor returns the fully-resolved palette for a Chroma style name, reporting whether the name is known. The lookup is case-sensitive; Chroma style names are lowercase (e.g. "dracula", "github-dark").