aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/borders.go2
-rw-r--r--lib/ui/tab.go12
-rw-r--r--lib/ui/text.go10
3 files changed, 14 insertions, 10 deletions
diff --git a/lib/ui/borders.go b/lib/ui/borders.go
index 97df5df9..9b7860e4 100644
--- a/lib/ui/borders.go
+++ b/lib/ui/borders.go
@@ -49,7 +49,7 @@ func (bordered *Bordered) Draw(ctx *Context) {
y := 0
width := ctx.Width()
height := ctx.Height()
- style := tcell.StyleDefault.Background(tcell.ColorWhite).Foreground(tcell.ColorBlack)
+ style := tcell.StyleDefault.Reverse(true)
if bordered.borders&BORDER_LEFT != 0 {
ctx.Fill(0, 0, 1, ctx.Height(), ' ', style)
x += 1
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index 32b195c3..49bdffa8 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -83,19 +83,13 @@ func (tabs *Tabs) Select(index int) {
func (strip *TabStrip) Draw(ctx *Context) {
x := 0
for i, tab := range strip.Tabs {
- style := tcell.StyleDefault.
- Background(tcell.ColorWhite).
- Foreground(tcell.ColorBlack)
+ style := tcell.StyleDefault.Reverse(true)
if strip.Selected == i {
- style = tcell.StyleDefault.
- Background(tcell.ColorDefault).
- Foreground(tcell.ColorDefault)
+ style = tcell.StyleDefault
}
x += ctx.Printf(x, 0, style, " %s ", tab.Name)
}
- style := tcell.StyleDefault.
- Background(tcell.ColorWhite).
- Foreground(tcell.ColorBlack)
+ style := tcell.StyleDefault.Reverse(true)
ctx.Fill(x, 0, ctx.Width()-x, 1, ' ', style)
}
diff --git a/lib/ui/text.go b/lib/ui/text.go
index b962166d..aa97954f 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)
}