diff options
| author | Paul Buetow <paul@buetow.org> | 2021-09-08 19:10:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-02 12:26:29 +0300 |
| commit | 16dc57e1e1c28e9d762424e596223a980770e059 (patch) | |
| tree | ea5a7d5caa7f4de7bd3b21e57d0e18c0d8507c7d /internal/color | |
| parent | c83c9e61a08c7ea1cb528bc26dfab25b46faa866 (diff) | |
mapreduce tables are in colors now too
Diffstat (limited to 'internal/color')
| -rw-r--r-- | internal/color/paint.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/color/paint.go b/internal/color/paint.go index 5430acd..53c9abb 100644 --- a/internal/color/paint.go +++ b/internal/color/paint.go @@ -63,6 +63,19 @@ func PaintWithAttr(sb *strings.Builder, text string, fg FgColor, bg BgColor, att sb.WriteString(string(FgDefault)) } +// PaintWithAttrs is similar to PaintWithAttr, but it takes multiple text attributes. +func PaintWithAttrs(sb *strings.Builder, text string, fg FgColor, bg BgColor, attrs []Attribute) { + sb.WriteString(string(fg)) + sb.WriteString(string(bg)) + for _, attr := range attrs { + sb.WriteString(string(attr)) + } + sb.WriteString(text) + sb.WriteString(string(AttrReset)) + sb.WriteString(string(BgDefault)) + sb.WriteString(string(FgDefault)) +} + // ResetWithAttr resets background, foreground and attributes. func ResetWithAttr(sb *strings.Builder) { sb.WriteString(string(AttrReset)) |
