Documentation
¶
Overview ¶
Package ui is the single styling layer for everything assay prints to a human. Commands describe output in semantic terms — good, warn, bad, muted, a badge, a progress bar, a table — and the active styler decides how that looks. The default build renders through lipgloss; building with the assay_plain tag swaps in a stdlib-only styler with the same semantics, so the charm dependencies vanish from the binary entirely.
Both stylers are constructed with an explicit enabled flag derived from --no-color and TTY detection, and neither queries the terminal: color support is decided by the caller, never sniffed with escape-sequence round-trips that could stall startup.
Index ¶
- type Painter
- func (p Painter) Accent(s string) string
- func (p Painter) Bad(s string) string
- func (p Painter) Badge(tone Tone, text string) string
- func (p Painter) Bar(fraction float64, width int) string
- func (p Painter) Bold(s string) string
- func (p Painter) Enabled() bool
- func (p Painter) Good(s string) string
- func (p Painter) Goodf(format string, args ...any) string
- func (p Painter) Muted(s string) string
- func (p Painter) Mutedf(format string, args ...any) string
- func (p Painter) Rule(width int) string
- func (p Painter) Table(headers []string, rows [][]string) string
- func (p Painter) Warn(s string) string
- type Tone
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Painter ¶
type Painter struct {
// contains filtered or unexported fields
}
func (Painter) Badge ¶
Badge renders a short, shouty label — SURVIVED, KILLED, FLAKY — that reads as a chip on capable terminals and as a bracketed tag everywhere else.
func (Painter) Bar ¶
Bar renders a progress bar of the given cell width. The fraction is clamped; the bar itself is plain unicode so both stylers share it, with the filled span tinted when color is on.