theme

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package theme defines the color system for the UI. A theme is derived from a compact Palette so that built-in themes are pure data.

Index

Constants

View Source
const DefaultName = "sorbet"

DefaultName is the name of the palette used when no theme is configured.

Variables

This section is empty.

Functions

func Names

func Names() []string

Names returns the names of all built-in palettes, sorted.

Types

type Palette

type Palette struct {
	Name string

	Bg     string // main background (kept for contrast fills, e.g. text on tags)
	Fg     string // main text
	BgSoft string // alternating row / status-bar / subtle panel background
	FgDim  string // dimmed text (gutter, placeholders, borders)

	Header    string // table header foreground
	Accent    string // primary accent (selection background)
	AccentFg  string // text on top of Accent
	Highlight string // search-match / emphasis foreground

	Error   string
	Warning string
	Success string

	// Series colors used for status-bar tags and plot groups; at least 4.
	Series []string
}

Palette is the raw color definition of a theme. All colors are hex strings like "#1e1e2e".

type Theme

type Theme struct {
	Palette Palette

	// base
	Text    lipgloss.Style
	Subtle  lipgloss.Style
	Error   lipgloss.Style
	Warning lipgloss.Style
	Success lipgloss.Style

	// table
	Header      lipgloss.Style
	RowEven     lipgloss.Style
	RowOdd      lipgloss.Style
	RowSelected lipgloss.Style
	ColCursor   lipgloss.Style // current column header cursor (soft highlight)
	Gutter      lipgloss.Style
	Border      lipgloss.Style
	Match       lipgloss.Style // search-match cell emphasis

	// status bar
	StatusBar lipgloss.Style

	// popups / prompts
	PopupBorder  lipgloss.Style
	PopupTitle   lipgloss.Style
	ListItem     lipgloss.Style
	ListSelected lipgloss.Style
	Input        lipgloss.Style
	Placeholder  lipgloss.Style
}

Theme holds ready-to-use styles derived from a Palette.

func Builtin

func Builtin(name string) (*Theme, bool)

Builtin returns the derived Theme for a built-in palette name. The lookup is case-insensitive and ignores surrounding whitespace. Derived themes are cached, so repeated lookups are cheap.

func Default

func Default() *Theme

Default returns the default built-in theme.

func New

func New(p Palette) *Theme

New derives a full Theme from a palette.

Base styles carry no background so the terminal's own background shows through; explicit backgrounds are kept only where the fill itself carries meaning (selection, the odd-row stripe, the status bar).

func (*Theme) SeriesColor

func (t *Theme) SeriesColor(i int) color.Color

SeriesColor returns the i-th series color, cycling.

Jump to

Keyboard shortcuts

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