theme

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

func Huh(p Palette) *huh.Theme

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.

func Names

func Names() []string

Names returns the built-in theme names: github-dark (the default) first, then the rest sorted.

func Path

func Path() (string, error)

Path returns the location of the themes file (Home()/themes.yaml, mirroring config.Path / plans.Path — same directory, honoring $HLAB_HOME).

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.

func Get

func Get(name string) Palette

Get returns the palette for name (case-insensitive, surrounding space tolerated). An unknown or empty name falls back to github-dark, the default — theme selection never errors, so a typo in config.yaml just yields the standard look.

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

func Load() (*Set, error)

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

func (s *Set) Get(name string) Palette

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.

func (*Set) Has

func (s *Set) Has(name string) bool

Has reports whether name is a known theme in the set (case-insensitive).

func (*Set) Names

func (s *Set) Names() []string

Names returns the theme names in the set (built-ins + file themes): github-dark (the default) first, then the rest sorted, so the TUI selector and `hlab theme` list them in a stable order with the default on top.

Jump to

Keyboard shortcuts

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