Documentation
¶
Overview ¶
Package theme provides the v2 Tufte-Swiss theme system: structure (bold, dim, alignment) lives in the mono preset; color layers on top.
Two presets, no interface. Mono is the base — Color calls Mono first and overlays chroma on the severity and outcome styles. NO_COLOR forces Mono regardless of TTY (this is checked by Default).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Icons ¶
type Icons struct {
Pass string
Fail string
Warn string
Note string
Panic string
BuildError string
Bullet string
Bar string
BarEmpty string
Up string
Down string
Same string
}
Icons are the Tufte-Swiss glyph set: minimal, no box-drawing. Bar / BarEmpty are the segments used by the paint package's bar primitive; Up / Down / Same drive the Delta view.
type OutputKind ¶
type OutputKind int
OutputKind names the destination an output stream is connected to. Used by Default to pick the right theme without exposing a bool trap.
const ( // OutputTTY: stdout is an interactive terminal. OutputTTY OutputKind = iota // OutputPipe: stdout is redirected (pipe, file, or non-TTY). OutputPipe )
func OutputKindFromTTY ¶
func OutputKindFromTTY(isTTY bool) OutputKind
OutputKindFromTTY adapts a "is this a TTY?" bool to an OutputKind. Convenience for the one place we still get the answer as a bool (term.IsTerminal on a syscall fd).
type Theme ¶
type Theme struct {
Name string
// Severity styles for static-analysis findings.
Error lipgloss.Style
Warning lipgloss.Style
Note lipgloss.Style
// Outcome styles for go test results.
Pass lipgloss.Style
Fail lipgloss.Style
Skip lipgloss.Style
Panic lipgloss.Style
BuildError lipgloss.Style
// Structural styles.
Bold lipgloss.Style
Muted lipgloss.Style
Heading lipgloss.Style
Icons Icons
}
Theme bundles every style and glyph the renderer needs. One value per run, threaded through the views.
func Color ¶
func Color() Theme
Color overlays chroma on Mono. The structural styles (Bold, Muted, Heading) are unchanged; severity and outcome get foreground colors. Glyphs upgrade from ASCII to Unicode where it adds clarity.
func Default ¶
func Default(out OutputKind) Theme
Default returns the right theme for the environment: Mono when NO_COLOR is set or when the output is not a TTY; Color otherwise.