Documentation ¶
Index ¶
- Constants
- Variables
- func Capped(cap int, v interface{}) string
- func Colored(s interface{}, colorNames ...string) string
- func ColoredWithCode(s interface{}, fg, bg Color) string
- func ColoredWithName(s interface{}, fgName, bgName string) string
- func DebugShowcase()
- func Join(sep string, values ...interface{}) string
- func MakeQuickColorFunc(fg Color) func(s interface{}) string
- func NoopColored(v interface{}, _ ...string) interface{}
- func NoopQuickColor(v interface{}) interface{}
- func Padding(padding int, v interface{}) string
- func Sprint(val interface{}) string
- type Color
Constants ¶
View Source
const ( Default = Color(iota) Black Red Green Yellow Blue Magenta Cyan Gray BoldBlack BoldRed BoldGreen BoldYellow BoldBlue BoldMagenta BoldCyan BoldGray )
Variables ¶
View Source
var ( TmplColorFuncMap template.FuncMap TmplColorFuncMapNonTerm template.FuncMap )
View Source
var ( FgColors []string BgColors []string ResetColor = "\x1b[39;49;22m" )
View Source
var ColorNames = map[string]Color{ "black": Black, "red": Red, "green": Green, "yellow": Yellow, "blue": Blue, "magenta": Magenta, "cyan": Cyan, "gray": Gray, "black_b": BoldBlack, "red_b": BoldRed, "green_b": BoldGreen, "yellow_b": BoldYellow, "blue_b": BoldBlue, "magenta_b": BoldMagenta, "cyan_b": BoldCyan, "gray_b": BoldGray, }
ColorNames names can be used for generic color function. quick foreground color function with same name is also availalbe in template
Functions ¶
func Capped ¶
Capped truncate given value to specified length if cap > 0: with tailing "..." if truncated if cap < 0: with middle "..." if truncated
func Colored ¶
Colored takes 0, 1, or 2 color names when present, they should be in order of fgName, bgName
func ColoredWithCode ¶
func ColoredWithName ¶
func DebugShowcase ¶
func DebugShowcase()
func MakeQuickColorFunc ¶
func NoopColored ¶
func NoopColored(v interface{}, _ ...string) interface{}
func NoopQuickColor ¶
func NoopQuickColor(v interface{}) interface{}
Types ¶
Click to show internal directories.
Click to hide internal directories.