summary refs log tree commit diff stats
path: root/lib/ui/text.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-30 12:59:18 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-30 12:59:18 -0400
commit84965d680cff655c7734070ef93fd3c1e2177748 (patch)
treea77f59f78406a958795a14bf40292f31f25ddc24 /lib/ui/text.go
parent700dea23fa75f213af2f99449db994008eab9d21 (diff)
downloadaerc-84965d680cff655c7734070ef93fd3c1e2177748.tar.gz
Use tcell.Style.Reverse instead of black on white
Diffstat (limited to 'lib/ui/text.go')
-rw-r--r--lib/ui/text.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ui/text.go b/lib/ui/text.go
index b962166..aa97954 100644
--- a/lib/ui/text.go
+++ b/lib/ui/text.go
@@ -16,6 +16,7 @@ type Text struct {
 	strategy     uint
 	fg           tcell.Color
 	bg           tcell.Color
+	reverse      bool
 	onInvalidate func(d Drawable)
 }
 
@@ -46,6 +47,12 @@ func (t *Text) Color(fg tcell.Color, bg tcell.Color) *Text {
 	return t
 }
 
+func (t *Text) Reverse(reverse bool) *Text {
+	t.reverse = reverse
+	t.Invalidate()
+	return t
+}
+
 func (t *Text) Draw(ctx *Context) {
 	size := runewidth.StringWidth(t.text)
 	x := 0
@@ -56,6 +63,9 @@ func (t *Text) Draw(ctx *Context) {
 		x = ctx.Width() - size
 	}
 	style := tcell.StyleDefault.Background(t.bg).Foreground(t.fg)
+	if t.reverse {
+		style = style.Reverse(true)
+	}
 	ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', style)
 	ctx.Printf(x, 0, style, t.text)
 }