Documentation
¶
Overview ¶
Package color provides terminal color output support for JVS. It respects the NO_COLOR environment variable (https://no-color.org/).
Index ¶
- Constants
- Variables
- func Code(s string) string
- func CodeFor(file *os.File, s string) string
- func Dim(s string) string
- func DimFor(file *os.File, s string) string
- func Disable()
- func Enable()
- func Enabled() bool
- func EnabledFor(file *os.File) bool
- func Error(s string) string
- func ErrorFor(file *os.File, s string) string
- func Errorf(format string, args ...any) string
- func Header(s string) string
- func Highlight(s string) string
- func Info(s string) string
- func Infof(format string, args ...any) string
- func Init(noColorFlag bool)
- func SnapshotID(s string) string
- func Success(s string) string
- func Successf(format string, args ...any) string
- func Tag(s string) string
- func Warning(s string) string
- func Warningf(format string, args ...any) string
Constants ¶
View Source
const ( Reset = "\033[0m" Bold = "\033[1m" DimCode = "\033[2m" Underline = "\033[4m" // Foreground colors Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" Gray = "\033[90m" // Background colors BgRed = "\033[41m" BgGreen = "\033[42m" BgYellow = "\033[43m" BgBlue = "\033[44m" BgMagenta = "\033[45m" BgCyan = "\033[46m" )
ANSI color codes
Variables ¶
View Source
var ( Redf = makeColorFunc(Red) Greenf = makeColorFunc(Green) Yellowf = makeColorFunc(Yellow) Bluef = makeColorFunc(Blue) Magentaf = makeColorFunc(Magenta) Cyanf = makeColorFunc(Cyan) Whitef = makeColorFunc(White) Grayf = makeColorFunc(Gray) Boldf = makeColorFunc(Bold) Dimf = makeColorFunc(DimCode) )
Pre-defined color functions
Functions ¶
func EnabledFor ¶
EnabledFor returns true if color output is enabled for file.
func Init ¶
func Init(noColorFlag bool)
Init initializes the color system based on environment and flags. It respects the NO_COLOR environment variable (https://no-color.org/) and can be disabled programmatically. Color is enabled only for interactive terminal output; CI and redirected output stay plain for deterministic logs. Init does not override explicit Enable()/Disable() calls.
func SnapshotID ¶
SnapshotID formats a snapshot ID in cyan (for visibility).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.