Add more color constants
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2021-04-07 13:08:40 -04:00
parent 6f51f441e3
commit 9c1fa5402d

View File

@ -31,16 +31,59 @@ const (
// Color sequences
const (
// Background
BGBlack = EscPrefix + "40m"
BGRed = EscPrefix + "41m"
BGGreen = EscPrefix + "42m"
BGYellow = EscPrefix + "43m"
BGBlue = EscPrefix + "44m"
BGMagenta = EscPrefix + "45m"
BGCyan = EscPrefix + "46m"
BGWhite = EscPrefix + "47m"
BGBrightBlack = EscPrefix + "100m"
BGBrightRed = EscPrefix + "101m"
BGBrightGreen = EscPrefix + "102m"
BGBrightYellow = EscPrefix + "103m"
BGBrightBlue = EscPrefix + "104m"
BGBrightMagenta = EscPrefix + "105m"
BGBrightCyan = EscPrefix + "106m"
BGBrightWhite = EscPrefix + "107m"
// Foreground
FGBlack = EscPrefix + "30m"
FGRed = EscPrefix + "31m"
FGGreen = EscPrefix + "32m"
FGYellow = EscPrefix + "33m"
FGBlue = EscPrefix + "34m"
FGMagenta = EscPrefix + "35m"
FGCyan = EscPrefix + "36m"
FGWhite = EscPrefix + "37m"
FGBrightBlack = EscPrefix + "90m"
FGBrightRed = EscPrefix + "91m"
FGBrightGreen = EscPrefix + "92m"
FGBrightYellow = EscPrefix + "93m"
FGBrightBlue = EscPrefix + "94m"
FGBrightMagenta = EscPrefix + "95m"
FGBrightCyan = EscPrefix + "96m"
FGBrightWhite = EscPrefix + "97m"
// Defaults
DefaultBGColor = EscPrefix + "49m"
DefaultFGColor = EscPrefix + "39m"
FGRed = EscPrefix + "31m"
InvertColor = EscPrefix + "7m"
ResetColor = EscPrefix + "m"
InvertColor = EscPrefix + "7m"
ResetColor = EscPrefix + "m"
)
// ----------------------------------------------------------------------------
// !Helpers
// ----------------------------------------------------------------------------
// Generate RGB color ansi escape sequences
func RGBColor(r, g, b int) string {
return Code("48;2;%d;%d;%dm", r, g, b)
}
// Add the ANSI escape code prefix to the relevant escape code
func Code(s string, a ...interface{}) string {
str := fmt.Sprintf(s, a...)