This repository has been archived on 2021-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
beaver/color/README.md
John Olheiser c628fd1987 Add extended and true colors (#3)
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: #3
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-committed-by: John Olheiser <john.olheiser@gmail.com>
2021-02-17 05:44:17 +08:00

742 B

Color

Beaver comes with the color sub-package that can be used even without Beaver calls.

Color is an interface that simply needs Format(text string) string to fulfill it.
Any logger in beaver can be set to a Color.

Formatting a string with a single attribute

text := color.FgRed.Format("red")

Formatting a string with a full color

text := color.New(color.BgGreen, color.FgRed, color.Bold).Format("green background, red text, and bold")

Extended colors

Extended colors are 256-color extensions. They can be referred to by name, available in extended_colors.go.

True colors

True colors are full RBG colors, they can be either created with RGB values or parsed from hex.