Documentation ¶
Index ¶
- Constants
- Variables
- func Color256Code(styleCode string) string
- func Color256Wrap(text string, style string) string
- func ColorCode(styleCode string) string
- func ColorRGB(fg int, bg int) string
- func ColorWrap(text string, style string) string
- func Colorize(pattern *regexp.Regexp, text string) string
- func ColorizeByColorName(text string) string
- func HighlightLogLevel(detectedLevels []string, matches []string, text string) string
- func HighlightSelection(text string, selection []int, style string) string
- func NameToAnsi256(name string) int
- func RGB(r, g, b uint) uint
- type ColorizerFunc
Constants ¶
const ( // Reset is an ANSI sequence to reset colors to defaults Reset = "\033[39;49m" // ResetFg is an ANSI sequence to reset foreground color to default ResetFg = "\033[39m" // ResetBg is an ANSI sequence to reset background color to default ResetBg = "\033[49m" )
Variables ¶
var ( //StreamNameColorizer is a colorizer function for log stream name StreamNameColorizer = ColorWrapFunc("+b") //TimestampColorizer is a colorizer function for log event timestamp TimestampColorizer = ColorWrapFunc("+i") )
Functions ¶
func Color256Code ¶ added in v0.1.2
func Color256Wrap ¶ added in v0.1.2
func ColorRGB ¶
ColorRGB returns the ANSI color code for an RGB color pass -1 if you don't want to change either foreground or background
func ColorWrap ¶ added in v0.1.0
ColorWrap sets the style for the passed string and then resets it to default
func ColorizeByColorName ¶ added in v0.1.2
func HighlightLogLevel ¶
HighlightLogLevel applies loglevel-specific background color to the provided text Warning background is applied if logLevel is equal to "WARN" or "WARNING" and Error background is applied for "ERROR" logLevel
func HighlightSelection ¶ added in v0.1.0
HighlightSelection highlights slice of the string with indexes provided in selection with a style
func NameToAnsi256 ¶ added in v0.1.2
Types ¶
type ColorizerFunc ¶
ColorizerFunc colorizes a string
func ColorFunc ¶
func ColorFunc(color string) ColorizerFunc
ColorFunc returns a function that sets the color for the passed string
func ColorWrapFunc ¶
func ColorWrapFunc(style string) ColorizerFunc
ColorWrapFunc returns a function that sets the style for the passed string and then resets it to default