Documentation
¶
Overview ¶
Package style is flate's terminal presentation layer: the glyphs, lipgloss color helpers, ANSI-aware truncation, and duration formatting shared by the CLI status bar and the `flate test` report, so both surfaces speak one vocabulary instead of hand-rolling escape codes and symbols.
Color is gated per output writer: callers resolve ColorEnabled(w) once (a pipe, NO_COLOR, CLICOLOR=0, or a dumb terminal renders plain) and thread the bool through, keeping the renderers pure and deterministic for tests.
Index ¶
- Constants
- func Bold(s string, color bool) string
- func ColorEnabled(w io.Writer) bool
- func Cyan(s string, color bool) string
- func Dim(s string, color bool) string
- func Elapsed(d time.Duration) string
- func Fail(s string, color bool) string
- func Pass(s string, color bool) string
- func Skip(s string, color bool) string
- func Truncate(s string, width int) string
Constants ¶
const ( GlyphPass = "✓" GlyphFail = "✗" GlyphSkip = "‒" )
Status glyphs shared across surfaces: a passing/success mark, a failure mark, and a skipped/secondary dash. Pair with Pass/Fail/Skip for color.
Variables ¶
This section is empty.
Functions ¶
func ColorEnabled ¶
ColorEnabled reports whether w should receive ANSI styling. colorprofile.Detect honors NO_COLOR / CLICOLOR(_FORCE) and TTY-ness; anything at or below Ascii (a pipe, a redirect, a dumb terminal) renders plain.
func Elapsed ¶
Elapsed renders a duration compactly for live and summary timing: tenths of a second under a minute, m+ss above it.
Types ¶
This section is empty.