diff options
Diffstat (limited to 'common/terminal/colors.go')
-rw-r--r-- | common/terminal/colors.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/terminal/colors.go b/common/terminal/colors.go index 691173ea8..a02d016d9 100644 --- a/common/terminal/colors.go +++ b/common/terminal/colors.go @@ -23,7 +23,9 @@ import ( ) const ( - noticeColor = "\033[1;36m%s\033[0m" + errorColor = "\033[1;31m%s\033[0m" + warningColor = "\033[0;33m%s\033[0m" + noticeColor = "\033[1;36m%s\033[0m" ) // IsTerminal return true if the file descriptor is terminal and the TERM @@ -38,6 +40,16 @@ func Notice(s string) string { return colorize(s, noticeColor) } +// Error colorizes the string in a colour that grabs attention. +func Error(s string) string { + return colorize(s, errorColor) +} + +// Warning colorizes the string in a colour that warns. +func Warning(s string) string { + return colorize(s, warningColor) +} + // colorize s in color. func colorize(s, color string) string { s = fmt.Sprintf(color, doublePercent(s)) |