Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ColoredOutput will check if color escape codes should be printed. This can be changed // for testing to an arbitrary method. ColoredOutput = coloredOutput // IsTerminal will check if the specified output stream is a terminal. This can be changed // for testing to an arbitrary method. IsTerminal = isTerminal // NoColor allow to force to not output colors. NoColor = false )
var ( LightRed = Color(91) LightGreen = Color(92) LightYellow = Color(93) LightBlue = Color(94) LightPurple = Color(95) Red = Color(31) Green = Color(32) Yellow = Color(33) Blue = Color(34) Purple = Color(35) Cyan = Color(36) White = Color(37) // None uses ANSI escape codes to reset all formatting. None = Color(0) // Default default output color for output from container-structure-test to the user Default = None )
Define some Color instances that can format text to be displayed to the terminal in color, using ANSI escape codes.
Functions ¶
func OverwriteDefault ¶
func OverwriteDefault(color Color)
OverwriteDefault overwrites default color
Types ¶
type Color ¶
type Color int
Color can be used to format text using ANSI escape codes so it can be printed to the terminal in color.
func (Color) Fprint ¶
Fprint wraps the operands in c's ANSI escape codes, and outputs the result to out. If out is not a terminal, the escape codes will not be added. It returns the number of bytes written and any errors encountered.
func (Color) Fprintf ¶
Fprintf applies formats according to the format specifier (and the optional interfaces provided), wraps the result in c's ANSI escape codes, and outputs the result to out, followed by a newline. If out is not a terminal, the escape codes will not be added. It returns the number of bytes written and any errors encountered.
type ColoredWriteCloser ¶
type ColoredWriteCloser struct {
io.WriteCloser
}
ColoredWriteCloser forces printing with colors to an io.WriteCloser.
type ColoredWriter ¶
ColoredWriter forces printing with colors to an io.Writer.