theme

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 2 Imported by: 0

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

View Source
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

func ForegroundFor(name string) string

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.

func Names

func Names() []string

Names returns the sorted list of known palette (Chroma style) names.

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

func PaletteFor(name string) (Palette, bool)

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").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL