Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Colors = make(map[string]*Color)
map Colors is the list of known colors. Colors are added with AddColor(), and REs are added to that color with c.AddRE().
Functions ¶
func Colorize ¶ added in v1.0.5
Colorize iterates over each Color and applies all of the regexps associated with that color to the supplied string.
func ColorizeString ¶ added in v1.0.5
ColorizeString returns the string argument in a specific color.
Types ¶
type Color ¶
type Color struct { // RE is a slice of regexps that, when matched, are colorized RE []*regexp.Regexp // Colorizer is a function (generally from another package) // that returns a colorized version of its string arguments. Colorizer func(...any) string }
struct Color holds the configuration for each handled termcolor.
func AddColor ¶ added in v1.2.0
AddColor takes a color string, creates a renderer for it, and adds it to the Colors map. It returns the Color so that c.AddRE() can be chained.
Click to show internal directories.
Click to hide internal directories.