Documentation
¶
Overview ¶
Package color provides utilities for colorizing terminal output using ANSI escape codes.
Index ¶
- Constants
- Variables
- func Black(v any) string
- func BlackBg(v any) string
- func Blue(v any) string
- func BlueBg(v any) string
- func Cyan(v any) string
- func CyanBg(v any) string
- func Green(v any) string
- func GreenBg(v any) string
- func Magenta(v any) string
- func MagentaBg(v any) string
- func Red(v any) string
- func RedBg(v any) string
- func UnsafeString(b []byte) string
- func White(v any) string
- func WhiteBg(v any) string
- func Wrap(c Color, v any) string
- func Yellow(v any) string
- func YellowBg(v any) string
- type Color
Constants ¶
View Source
const ( Reset = "\x1b[0m" FgBlack = "\x1b[30m" FgRed = "\x1b[31m" FgGreen = "\x1b[32m" FgYellow = "\x1b[33m" FgBlue = "\x1b[34m" FgMagenta = "\x1b[35m" FgCyan = "\x1b[36m" FgWhite = "\x1b[37m" BgBlack = "\x1b[40m" BgRed = "\x1b[41m" BgGreen = "\x1b[42m" BgYellow = "\x1b[43m" BgBlue = "\x1b[44m" BgMagenta = "\x1b[45m" BgCyan = "\x1b[46m" BgWhite = "\x1b[47m" )
Variables ¶
View Source
var NoColor = isNoColor()
NoColor indicates whether colorization is disabled based on the NO_COLOR environment variable.
Functions ¶
func UnsafeString ¶
UnsafeString returns a unsafe string from a []byte
Types ¶
type Color ¶
type Color = string
Color represents an ANSI color code based on this [lookup table](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
Click to show internal directories.
Click to hide internal directories.