Documentation
¶
Overview ¶
tui/theme/builder.go
tui/theme/palette.go
tui/theme/registry.go
tui/theme/theme.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(t Theme)
SetDefault replaces the global Theme. Typical usage: called once at program startup before any output is emitted. Goroutine-safe.
Types ¶
type Option ¶
type Option func(*builder)
Option configures a Theme built by From.
type Palette ¶
type Palette struct {
// Semantic
Info lipgloss.AdaptiveColor
Success lipgloss.AdaptiveColor
Warning lipgloss.AdaptiveColor
Error lipgloss.AdaptiveColor
Muted lipgloss.AdaptiveColor
Text lipgloss.AdaptiveColor
Heading lipgloss.AdaptiveColor
Path lipgloss.AdaptiveColor
// Diff — functional colors for unified diff output; kept separate from
// semantic roles so Success/Error can evolve independently.
DiffAdd lipgloss.AdaptiveColor // added lines (+)
DiffRemove lipgloss.AdaptiveColor // removed lines (-)
// Severity
Critical lipgloss.AdaptiveColor
High lipgloss.AdaptiveColor
Medium lipgloss.AdaptiveColor
Low lipgloss.AdaptiveColor
// Brand (SafeDep identity)
BrandPrimary lipgloss.AdaptiveColor
BrandAccent lipgloss.AdaptiveColor
// Background surfaces (for badges)
BgCritical lipgloss.AdaptiveColor
BgHigh lipgloss.AdaptiveColor
BgMedium lipgloss.AdaptiveColor
BgLow lipgloss.AdaptiveColor
BgInfo lipgloss.AdaptiveColor
BgSuccess lipgloss.AdaptiveColor
// BadgeText is the foreground color used inside saturated-background badges.
// Kept as an explicit palette slot (rather than a hardcoded constant in the
// style package) so high-contrast themes can override it.
BadgeText lipgloss.AdaptiveColor
}
Palette is the exhaustive set of named colors used across tui components. It is intentionally CLOSED — no Custom map escape hatch. Runtime-keyed or product-specific palettes stay in the consuming tool.
func (Palette) ColorByRole ¶
func (p Palette) ColorByRole(r Role) (lipgloss.AdaptiveColor, bool)
ColorByRole returns the AdaptiveColor for a role, or (zero, false).
func (Palette) WithColorByRole ¶
func (p Palette) WithColorByRole(r Role, c lipgloss.AdaptiveColor) Palette
WithColorByRole returns a copy of p with the given role replaced.
type Theme ¶
Theme is the unit of design language injection. Every component reads the installed Theme at render time via Default(); no component caches the resolved theme across renders.
func Default ¶
func Default() Theme
Default returns the globally installed Theme. Safe to call from any goroutine; components call this at every render.