Documentation
¶
Overview ¶
Package theme holds hlab's semantic color palette. Every color used by the dashboard TUI and the CLI result boxes is expressed as a role (Accent, Good, Bad, …) rather than a raw ANSI/hex literal, so the whole look can be swapped by selecting a different built-in palette via `theme:` in config.yaml.
It deliberately lives outside internal/tui so that cmd (the CLI) can consume the same palette without importing the TUI package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Huh ¶
Huh builds a huh form theme matching the given palette. It starts from the minimal base theme and recolors the focused/blurred field styles from the semantic palette so both the embedded TUI wizards and the CLI forms (`hlab setup`, the create wizard, confirms) look like part of hlab rather than a default huh form.
Types ¶
type Palette ¶
type Palette struct {
Accent lipgloss.Color // titles, selectors, focus, borders on emphasis
Text lipgloss.Color // bright/primary text
Dim lipgloss.Color // descriptions, hints, muted borders
Good lipgloss.Color // success / selected / low-utilization gauge
Warn lipgloss.Color // warning / mid-utilization gauge
Bad lipgloss.Color // errors / high-utilization gauge
Track lipgloss.Color // rules and the unfilled part of a meter
ModalBG lipgloss.Color // floating wizard-window background
OutBG lipgloss.Color // embedded "terminal" output-box background
OutFG lipgloss.Color // embedded "terminal" output-box foreground
Heading lipgloss.Color // brightest text (running guest names, panel headings)
Faint lipgloss.Color // most muted text (ids, table headers, footer descriptions)
Line lipgloss.Color // meter tracks / stronger rules
LineSoft lipgloss.Color // header underrule, soft panel borders
SelBG lipgloss.Color // selected-row background (a concrete pre-blended color)
}
Palette is the full set of semantic colors hlab draws with. The built-in palettes use truecolor hex for a fixed look (mono uses ANSI 256 codes so it respects the terminal's own scheme); lipgloss degrades truecolor automatically on 256/16-color terminals.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a merged, name-keyed collection of palettes: the compiled-in built-ins plus whatever the on-disk themes.yaml adds or overrides. It is the source of truth for the TUI selector and the `hlab theme` command.
func Load ¶
Load reads the merged theme set: the compiled-in built-ins with the on-disk themes.yaml merged on top (overriding/extending by name), seeding the file from the embedded default the first time. It ALWAYS returns a usable Set (never nil): on any path/read/parse error it returns the built-in-only set alongside the error, so a broken or deleted themes.yaml can never break the TUI or the CLI. Callers that only need the palette can ignore the error.
func (*Set) Get ¶
Get returns the palette for name (case-insensitive, space-tolerant). An unknown or empty name falls back to github-dark (the merged set's entry, so a user override of github-dark in themes.yaml is honored) — theme selection never errors.