ui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 4 Imported by: 0

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

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 New

func New(useColor bool) Painter

func (Painter) Accent

func (p Painter) Accent(s string) string

func (Painter) Bad

func (p Painter) Bad(s string) string

func (Painter) Badge

func (p Painter) Badge(tone Tone, text string) string

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

func (p Painter) Bar(fraction float64, width int) string

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.

func (Painter) Bold

func (p Painter) Bold(s string) string

func (Painter) Enabled

func (p Painter) Enabled() bool

func (Painter) Good

func (p Painter) Good(s string) string

func (Painter) Goodf

func (p Painter) Goodf(format string, args ...any) string

func (Painter) Muted

func (p Painter) Muted(s string) string

func (Painter) Mutedf

func (p Painter) Mutedf(format string, args ...any) string

func (Painter) Rule

func (p Painter) Rule(width int) string

Rule renders a soft horizontal divider.

func (Painter) Table

func (p Painter) Table(headers []string, rows [][]string) string

Table renders headers and rows as an aligned table. The charm build draws real borders; the plain build emits aligned columns that survive grep.

func (Painter) Warn

func (p Painter) Warn(s string) string

type Tone

type Tone int
const (
	ToneGood Tone = iota
	ToneWarn
	ToneBad
	ToneMuted
	ToneAccent
)

Jump to

Keyboard shortcuts

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