package console_fmt import ( "git.ma-al.com/maal-libraries/observer/pkg/level" ) const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorWhite = "\033[37m" ColorBlackOnYellow = "\033[43m\033[30m" ColorWhiteOnRed = "\033[37m\033[41m" ColorWhiteOnRedBlinking = "\033[37m\033[41m\033[5m" ColorBold = "\033[1m" ) func Bold(txt string) string { return ColorBold + txt + ColorReset } func Red(txt string) string { return ColorRed + txt + ColorReset } func Green(txt string) string { return ColorGreen + txt + ColorReset } func Yellow(txt string) string { return ColorYellow + txt + ColorReset } func Blue(txt string) string { return ColorBlue + txt + ColorReset } func Purple(txt string) string { return ColorPurple + txt + ColorReset } func Cyan(txt string) string { return ColorCyan + txt + ColorReset } func White(txt string) string { return ColorWhite + txt + ColorReset } func BlackOnYellow(txt string) string { return ColorBlackOnYellow + txt + ColorReset } func WhiteOnRed(txt string) string { return ColorWhiteOnRed + txt + ColorReset } func WhiteOnRedBlinking(txt string) string { return ColorWhiteOnRedBlinking + txt + ColorReset } func SeverityLevelToColor(lvl level.SeverityLevel) string { switch lvl { case level.TRACE: return ColorWhite case level.DEBUG: return ColorPurple case level.INFO: return ColorBlue case level.WARN: return ColorYellow case level.ERR: return ColorRed case level.CRIT: return ColorBlackOnYellow case level.ALERT: return ColorWhiteOnRed default: return ColorWhite } }