theme

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package theme is the semantic palette layer (doc 02 section 10, D18). A theme author fills in around thirty semantic colors; a pure expansion turns them into every component style the UI draws with. No widget constructs a color inline, which is what makes light and dark a property of the palette rather than a fork of the rendering code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Themes

func Themes() map[string]Theme

Themes lists the built-in themes by name, for config lookup.

Types

type Accent

type Accent struct {
	Color color.Color
	Glyph rune
}

Accent is one ant's stable color and glyph.

type DiffStyle

type DiffStyle struct {
	Add, Del         lipgloss.Style // whole-line backgrounds
	AddEmph, DelEmph lipgloss.Style // intra-line emphasis
	GutterAdd        lipgloss.Style
	GutterDel        lipgloss.Style
	LineNo           lipgloss.Style
	Context          lipgloss.Style
	Header           lipgloss.Style
}

DiffStyle is the style set the diff renderer pulls from the theme (doc 02 section 9.2).

type Palette

type Palette struct {
	// Brand and accent.
	Primary, Secondary, Accent, Keyword color.Color

	// Foreground ramp: from brightest text to faintest.
	FgBase, FgMuted, FgSubtle, FgFaint color.Color

	// Background ramp: base, raised panels, overlays, selection.
	BgBase, BgRaised, BgOverlay, BgSelection color.Color

	// Status.
	Success, Warning, Error, Info color.Color

	// Diff.
	DiffAdd, DiffDel, DiffAddEmph, DiffDelEmph color.Color

	// The ANSI-16 remap for embedded shell output.
	ANSI [16]color.Color

	// Dark reports whether this palette targets a dark terminal.
	Dark bool
}

Palette is the semantic color set a theme author fills in. Everything the UI draws derives from these colors; no component hardcodes one.

type Styles

type Styles struct {
	// Prose.
	Base, Muted, Subtle, Faint lipgloss.Style

	// Chat surfaces.
	UserPrompt lipgloss.Style // the user's own text
	Reasoning  lipgloss.Style // model thinking, dim
	ToolName   lipgloss.Style
	ToolInput  lipgloss.Style
	ToolOutput lipgloss.Style
	ToolErr    lipgloss.Style

	// Status.
	Success, Warning, Error, Info lipgloss.Style

	// Chrome.
	Title    lipgloss.Style
	Border   lipgloss.Style
	Selected lipgloss.Style

	// Sub-system configs derived from the same palette (doc 02
	// section 10.4).
	Diff     DiffStyle
	Markdown ansi.StyleConfig // glamour
	Chroma   *chroma.Style    // syntax highlighting
}

Styles is the expanded form of a palette: one field per component surface. Widgets read these; nothing else colors anything.

func Expand

func Expand(p Palette) Styles

Expand turns a Palette into the full Styles used by every widget. Adding a theme is filling in a Palette; the expansion is shared, so themes cannot drift in how they color, say, a warning versus an error.

type Theme

type Theme struct {
	Name string
	P    Palette
	S    Styles
	// contains filtered or unexported fields
}

Theme bundles a palette, its expanded styles, and the per-ant accent assignment (inert until the colony exists, doc 02 section 10.5).

func Dark

func Dark() Theme

Dark is the default palette for dark terminals.

func Light

func Light() Theme

Light is the default palette for light terminals.

func New

func New(name string, p Palette) Theme

New builds a theme from a palette.

func (*Theme) Accent

func (t *Theme) Accent(id string) Accent

Accent returns the stable accent for an ant, assigning one on first sight. The worker (and the empty ID) always gets the theme's primary with the pi glyph.

Jump to

Keyboard shortcuts

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