Documentation ¶
Overview ¶
colorize does ANSI colored output and emoji substitution.
Colorize takes a fmt.Printf() template string and looks for styles in the format:
{style-name:text}
And inserts the color esacpe sequences around the text. It then passes the template off to emoji.Sprintf() from https://github.com/kyokomi/emoji.
It uses the color attribute names, color.Output, and color.NoColor from https://github.com/fatih/color.
The style names are modeled off the basic bootstrap color names.
Example use:
colorize.Colorize("{primary:We} want {bg-success:beer :beer:} and {warning:pizza} :pizza:")
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Styles = map[string]*Style{ "primary": NewStyle(color.FgCyan, color.Bold), "bg-primary": NewStyle(color.FgHiWhite, color.BgCyan), "secondary": NewStyle(color.FgHiBlack, color.Bold), "bg-secondary": NewStyle(color.FgHiWhite, color.BgHiBlack), "light": NewStyle(color.FgHiBlack), "info": NewStyle(color.FgBlue, color.Bold), "bg-info": NewStyle(color.FgWhite, color.BgBlue), "success": NewStyle(color.FgGreen), "bg-success": NewStyle(color.FgHiWhite, color.BgGreen), "warning": NewStyle(color.FgYellow), "bg-warning": NewStyle(color.FgBlack, color.BgYellow), "danger": NewStyle(color.FgHiRed), "bg-danger": NewStyle(color.FgBlack, color.BgHiRed), }
Styles maps style names to styles
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.