colors

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Black color = iota
	Red
	Green
	Yellow
	Blue
	Purple
	Cyan
	White
)

Supported Colors use the iota pattern to assign unexported color (int) values to the available/exported color variables

Variables

This section is empty.

Functions

func Println

func Println(text string, c color)

Println prints the text in the designated color. It's second parameter is of type color which is unexported... This makes it so that the caller has to use one of the exported constant variables (which are of typecolor). Keeping the color type unexported makes it so that a caller can't create a new Color (if it were exported) and assign it to an arbitrary int. The default is to just fmt.Println() so it's not exactly defensive coding, however it is attempting to guide the caller into using the supported colors. Haven't figured out if this is bad practice due to the second param asking for an unexported type, or if this is an elegant enum type solution?

Types

This section is empty.

Jump to

Keyboard shortcuts

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