Documentation
¶
Overview ¶
Package theme is the lipgloss-free, JSON-driven colour theme for the v2 TUI. It loads the same theme JSON schema as pkg/tui/theme (the v1 system) but resolves each colour to its dark hex and emits truecolor ANSI directly — no lipgloss, stdlib only — so it compiles under both x/ansi lines (root v1 at 0.10.x and the v2 module at 0.11.x) and adds nothing to either dependency graph.
Import it aliased, since the package dir is "v2":
"github.com/zarldev/zarlmono/zkit/tui/theme"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Color ¶
type Color string
Color is a hex colour ("#rrggbb" or "#rgb"). The empty value renders nothing (no escape), so unset slots degrade to the terminal default.
type Theme ¶
type Theme struct {
Name string
// Surfaces.
Bg, Fg, Subtle, Muted Color
// Semantic accents.
Primary, Secondary Color
Success, Warning, Error, Info Color
// Conversation roles.
User, Assistant, Tool, System Color
// Structure.
Border, BorderFocus Color
Highlight, Selection, PlanMode Color
}
Theme is a resolved (dark-variant) colour set. Slots mirror the v1 theme so the JSON is interchangeable.
func DarkDefault ¶
func DarkDefault() Theme
DarkDefault returns the builtin theme marked default:dark (or the first builtin as a fallback).
func Decode ¶
Decode parses a theme JSON (the v1-compatible schema), resolving each colour to its dark variant.
func LoadBuiltins ¶
LoadBuiltins reads and decodes every embedded theme, returning them in directory order. Unlike the package-level accessors it surfaces failures: the returned error aggregates (via errors.Join) every per-file read or decode failure so a corrupt embedded theme is diagnosable instead of silently dropped. The themes that DID decode are still returned alongside any error, so a caller can use the good subset and log the rest.