Documentation
¶
Overview ¶
Package style is the single place that decides how text looks.
Detection (TTY? NO_COLOR? TERM=dumb? CI? old Windows console?) happens here once, so every app renders identically on Linux, macOS, and Windows. App code never prints with fmt directly and never imports color libraries directly; it asks style for writers and paint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Color ¶
Color reports whether ANSI color codes may be written to f. Precedence: noColor flag, NO_COLOR env, TERM=dumb, not-a-tty, CI.
Pass the --no-color flag value as noColor. Never read os.Stdout directly for this decision; always pass the actual destination file.
func Emoji ¶
func Emoji() bool
Emoji reports whether emoji glyphs may be used. False on dumb terminals, in CI, and on legacy Windows consoles (conhost without Windows Terminal, detected via missing WT_SESSION), where raster fonts cannot render them and they break column layout.
func IsTerminal ¶
IsTerminal reports whether f is an interactive terminal. Pipes, files, and CI log collectors are not terminals.
func Paint ¶
Paint wraps s in the given ANSI color when enabled is true, and returns s unchanged when false.
The per-instance switch (not the global color.NoColor) keeps this hermetic: parallel code paths can paint differently without racing.
func Stdout ¶
Stdout returns a writer for standard output that translates ANSI codes on legacy Windows consoles and passes through everywhere else. Always write through this, never os.Stdout directly.
Types ¶
This section is empty.