color

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LightRed can format text to be displayed to the terminal in light red, using ANSI escape codes.
	LightRed = Color(91)
	// LightGreen can format text to be displayed to the terminal in light green, using ANSI escape codes.
	LightGreen = Color(92)
	// LightYellow can format text to be displayed to the terminal in light yellow, using ANSI escape codes.
	LightYellow = Color(93)
	// LightBlue can format text to be displayed to the terminal in light blue, using ANSI escape codes.
	LightBlue = Color(94)
	// LightPurple can format text to be displayed to the terminal in light purple, using ANSI escape codes.
	LightPurple = Color(95)
	// Red can format text to be displayed to the terminal in red, using ANSI escape codes.
	Red = Color(31)
	// Green can format text to be displayed to the terminal in green, using ANSI escape codes.
	Green = Color(32)
	// Yellow can format text to be displayed to the terminal in yellow, using ANSI escape codes.
	Yellow = Color(33)
	// Blue can format text to be displayed to the terminal in blue, using ANSI escape codes.
	Blue = Color(34)
	// Purple can format text to be displayed to the terminal in purple, using ANSI escape codes.
	Purple = Color(35)
	// Cyan can format text to be displayed to the terminal in cyan, using ANSI escape codes.
	Cyan = Color(36)
	// White can format text to be displayed to the terminal in white, using ANSI escape codes.
	White = Color(37)
	// None uses ANSI escape codes to reset all formatting.
	None = Color(0)

	// Default default output color for output from Skaffold to the user
	Default = Blue
)
View Source
var IsTerminal = isTerminal

IsTerminal will check if the specified output stream is a terminal. This can be changed for testing to an arbitrary method.

Functions

func ForceColors added in v0.28.0

func ForceColors() func()

func OverwriteDefault added in v0.23.0

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) Fprintf

func (c Color) Fprintf(out io.Writer, format string, a ...interface{}) (n int, err error)

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.

func (Color) Fprintln

func (c Color) Fprintln(out io.Writer, a ...interface{}) (n int, err error)

Fprintln wraps the operands 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 added in v0.21.1

type ColoredWriteCloser struct {
	io.WriteCloser
}

ColoredWriteCloser forces printing with colors to an io.WriteCloser.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL