Documentation ¶
Overview ¶
Package color provides functions for printing in different colors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color interface { Black(format string, a ...interface{}) string Red(format string, a ...interface{}) string Green(format string, a ...interface{}) string Yellow(format string, a ...interface{}) string Blue(format string, a ...interface{}) string Magenta(format string, a ...interface{}) string Cyan(format string, a ...interface{}) string White(format string, a ...interface{}) string DefaultColor(format string, a ...interface{}) string WithColor(code ColorCode, format string, a ...interface{}) string Enabled() bool }
Color provides an interface for a color or monochrome type that will be returned by NewColor() based on whether coloring is enabled or not.
func NewColor ¶
func NewColor(enableColor EnableColor) Color
NewColor returns a color or monochrome type depending on the value of enableColor. A monochrome type will always return the string in the default color.
type ColorCode ¶
type ColorCode int
ColorCode represents the int used for coloring formatted strings in a certain color.
type Colorfn ¶
Colorfn is a function type that takes a formatted string and returns it in a certain color.
type EnableColor ¶
type EnableColor int
EnableColor represents whether or not to return colored strings.
const ( ColorNever EnableColor = iota ColorAuto ColorAlways )
func (*EnableColor) Set ¶
func (ec *EnableColor) Set(s string) error
Set sets the EnableColor type based on the string value.
func (*EnableColor) String ¶
func (ec *EnableColor) String() string
String returns the string value of the EnableColor type.