This repository has been archived on 2021-06-21. You can view files and clone it, but cannot push or open issues/pull-requests.
beaver/color
John Olheiser 262effd971 Fix legacy code (#4)
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/jolheiser/beaver/pulls/4
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-committed-by: John Olheiser <john.olheiser@gmail.com>
2021-02-17 13:40:21 +08:00
..
README.md Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
basic.go Fix legacy code (#4) 2021-02-17 13:40:21 +08:00
basic_colors.go Fix legacy code (#4) 2021-02-17 13:40:21 +08:00
basic_test.go Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
color.go Fix legacy code (#4) 2021-02-17 13:40:21 +08:00
color_test.go Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
extended.go Fix legacy code (#4) 2021-02-17 13:40:21 +08:00
extended_colors.go Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
rgb.go Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
rgb_test.go Add extended and true colors (#3) 2021-02-17 05:44:17 +08:00
true.go Fix legacy code (#4) 2021-02-17 13:40:21 +08:00

README.md

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.