modulepackage
0.0.0-20190213212951-d06e56a500db
Repository: https://github.com/mitchellh/colorstring.git
Documentation: pkg.go.dev
# README
colorstring 
colorstring is a Go library for outputting colored strings to a console using a simple inline syntax in your string to specify the color to print as.
For example, the string [blue]hello [red]world
would output the text
"hello world" in two colors. The API of colorstring allows for easily disabling
colors, adding aliases, etc.
Installation
Standard go get
:
$ go get github.com/mitchellh/colorstring
Usage & Example
For usage and examples see the Godoc.
Usage is easy enough:
colorstring.Println("[blue]Hello [red]World!")
Additionally, the Colorize
struct can be used to set options such as
custom colors, color disabling, etc.
# Functions
Color colorizes your strings using the default settings.
ColorPrefix returns the color sequence that prefixes the given text.
Fprint is a convenience wrapper for fmt.Fprint with support for color codes.
Fprintf is a convenience wrapper for fmt.Fprintf with support for color codes.
Fprintln is a convenience wrapper for fmt.Fprintln with support for color codes.
Print is a convenience wrapper for fmt.Print with support for color codes.
Printf is a convenience wrapper for fmt.Printf with support for color codes.
Println is a convenience wrapper for fmt.Println with support for color codes.
# Variables
DefaultColors are the default colors used when colorizing.