Documentation
¶
Overview ¶
Package theme owns every styled surface in the v2 TUI. One Theme instance is constructed at startup (via Default) and passed by pointer to every component that renders. Components read styles off the struct rather than rebuilding them per frame.
The Rev field is the cache key for the transcript block cache (M3): swap the theme, bump Rev, and every cached block re-renders with the new styles. Components never compare Theme pointers — they compare Rev values.
Index ¶
Constants ¶
const SpinnerInterval = 100 * time.Millisecond
SpinnerInterval is the wall-clock cadence at which the TUI advances the spinner. 100 ms is light enough for a TUI redraw budget and the rate the user requested in v1.
Variables ¶
var SpinnerFrames = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}
SpinnerFrames is the braille-dot rotation used for any "ing" status (thinking, executing, draining, compacting). One frame per SpinnerInterval; consumers wrap via SpinnerFrame(i).
Functions ¶
func SpinnerFrame ¶
SpinnerFrame returns one frame of the rotation. The argument can be any non-negative tick counter; the function handles wrapping.
Types ¶
type Glyph ¶
Glyph pairs a status string (task or subagent) with the symbol and foreground color the TUI uses to render it. One source of truth for panels, transcript snapshots, and any future widget that wants consistent lifecycle vocabulary.
type Theme ¶
type Theme struct {
// Rev is bumped each time the theme is swapped wholesale. Block
// caches key off this so a theme swap forces a re-render. Default
// theme starts at Rev = 1 so zero-value Rev (= "uninitialised")
// stays a discriminator.
Rev uint64
// Chat blocks
UserPrompt lipgloss.Style
Assistant lipgloss.Style
Thinking lipgloss.Style
// Tool vocabulary — brown call, green success, RED reserved for
// real failures only. ToolResult uses soft sky blue so it sits
// beneath the brown call line as a calm output stream.
ToolCall lipgloss.Style
ToolOK lipgloss.Style
ToolErr lipgloss.Style
ToolResult lipgloss.Style
// Diff — M2 change: white text on solid acid-green / glitch-red
// backgrounds (was neon-fg on pastel-bg in v1). Reads as a filled
// bar across the transcript column; matches the "pro" diff look
// the user requested. Fill spans full transcript width via per-row
// Width() at render time (see components/diff).
DiffAdd lipgloss.Style
DiffRemove lipgloss.Style
DiffContext lipgloss.Style
DiffHeader lipgloss.Style
// Side panels — cyan headers, neutral content.
PanelHeader lipgloss.Style
PanelRow lipgloss.Style
PanelBorder lipgloss.Style
// Status bar — neon HUD, violet separator.
StatusBar lipgloss.Style
StatusKey lipgloss.Style
StatusValue lipgloss.Style
StatusSep lipgloss.Style
StatePill lipgloss.Style
// Errors / input / dims — input border cyan.
ErrorBanner lipgloss.Style
InputBorder lipgloss.Style
DimText lipgloss.Style
// Welcome banner — cyan ASCII art, violet double-border.
Banner lipgloss.Style
BannerBox lipgloss.Style
BannerInfo lipgloss.Style
Greeting lipgloss.Style
// System lifecycle blocks.
Compacting lipgloss.Style
Draining lipgloss.Style
// Tasks / paste / timeline — timeline sits back as muted grey so
// every transcript line doesn't read as an error.
TasksDone lipgloss.Style
PasteChip lipgloss.Style
Timeline lipgloss.Style
TimelineCut lipgloss.Style
TimelineAccent lipgloss.Style // cyan-bold variant for yank-mode focus
TimelineMatch lipgloss.Style // yellow-bold variant for search-match blocks
// Context HUD (status-bar context bar).
ContextBar lipgloss.Style
ContextFill lipgloss.Style
ContextRail lipgloss.Style
// Turn separator — barely-there chrome between agent loop iterations.
TurnSep lipgloss.Style
// contains filtered or unexported fields
}
Theme bundles every lipgloss style the v2 TUI needs. Held by pointer; mutations through theme-swap should produce a new *Theme with a higher Rev, never mutate fields in place.
func Default ¶
func Default() *Theme
Default returns the production NEON TOKYO theme. Construct once at program start and reuse for the session — Rev tracks identity for cache invalidation.