ANSI colors.
const ( Default = term.Default Black = term.Black DarkRed = term.DarkRed DarkGreen = term.DarkGreen Brown = term.Brown DarkBlue = term.DarkBlue DarkMagenta = term.DarkMagenta DarkCyan = term.DarkCyan Gray = term.Gray DarkGray = term.DarkGray Red = term.Red Green = term.Green Yellow = term.Yellow Blue = term.Blue Magenta = term.Magenta Cyan = term.Cyan White = term.White )
func IsTerminal(w io.Writer) bool
IsTerminal returns true if w writes to a terminal.
func NewColorLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger
NewColorLogger returns a Logger which writes colored logs to w. ANSI color codes for the colors returned by color are added to the formatted output from the Logger returned by newLogger and the combined result written to w.
func NewColorWriter(w io.Writer) io.Writer
NewColorWriter returns an io.Writer that writes to w and provides cross platform support for ANSI color codes. If w is not a terminal it is returned unmodified.
func NewLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger
NewLogger returns a Logger that takes advantage of terminal features if possible. Log events are formatted by the Logger returned by newLogger. If w is a terminal each log event is colored according to the color function.
▹ Example (LevelColors)
▹ Example (RedErrors)
Color represents an ANSI color. The zero value is Default.
type Color = term.Color
FgBgColor represents a foreground and background color.
type FgBgColor = term.FgBgColor