summaryrefslogtreecommitdiff
path: root/internal/color/color.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-08-10 12:05:40 +0300
committerPaul Buetow <paul@buetow.org>2021-08-10 12:05:40 +0300
commitf3e08046badcbc852a6875b5553ee0a648021552 (patch)
treefad12e3a3062d3a1f30b910e40a3dde02d87168d /internal/color/color.go
parent03ec9f8fc1b30d0efb60584c90a027ff5816d153 (diff)
can compile with new color codes
Diffstat (limited to 'internal/color/color.go')
-rw-r--r--internal/color/color.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/color/color.go b/internal/color/color.go
index 965675f..f444294 100644
--- a/internal/color/color.go
+++ b/internal/color/color.go
@@ -39,6 +39,7 @@ const (
BgWhite BgColor = escape + "[47m"
BgDefault BgColor = escape + "[49m"
+ AttrNone Attribute = ""
AttrReset Attribute = escape + "[0m"
AttrBold Attribute = escape + "[1m"
AttrDim Attribute = escape + "[2m"
@@ -61,6 +62,9 @@ func Paint(text string, fg FgColor, bg BgColor) string {
// PaintWithAttr paints a given text in a given foreground/background/attribute combination
func PaintWithAttr(text string, fg FgColor, bg BgColor, attr Attribute) string {
+ if attr == AttrNone {
+ return Paint(text, fg, bg)
+ }
return fmt.Sprintf("%s%s%s%s%s%s%s", fg, bg, attr, text, AttrReset, BgDefault, FgDefault)
}