diff options
author | Zdenek Crha <zdenek.crha@gmail.com> | 2020-09-21 12:11:39 +0200 |
---|---|---|
committer | Zdenek Crha <zdenek.crha@gmail.com> | 2020-09-27 09:22:34 +0200 |
commit | 6bf64841d381460f1e44adecd42132080d07fac9 (patch) | |
tree | 0dc49484c4e01a978d882fb8ab465bc88a1a9252 | |
parent | c0f6e6af7f4cfbd14ffb597659562367f25f5691 (diff) | |
download | git-bug-6bf64841d381460f1e44adecd42132080d07fac9.tar.gz |
Fix help bar readability in terminal with bright background
Set both background and foreground color when displaying help bar to
avoid sitation where default foreground color used by terminal is hard
to read on blue background (like cyan on blue or black on blue).
Apply colors to whole generated help bar to avoid 'stripes' of different
background color where whitespace is used between help items.
-rw-r--r-- | termui/help_bar.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/termui/help_bar.go b/termui/help_bar.go index 78f8ebca..9fc7c152 100644 --- a/termui/help_bar.go +++ b/termui/help_bar.go @@ -17,13 +17,13 @@ type helpBar []struct { func (hb helpBar) Render(maxX int) string { var builder strings.Builder for _, entry := range hb { - builder.WriteString(colors.BlueBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text))) + builder.WriteString(colors.White(colors.BlueBg(fmt.Sprintf("[%s] %s", entry.keys, entry.text)))) builder.WriteByte(' ') } l := text.Len(builder.String()) if l < maxX { - builder.WriteString(colors.BlueBg(strings.Repeat(" ", maxX-l))) + builder.WriteString(colors.White(colors.BlueBg(strings.Repeat(" ", maxX-l)))) } return builder.String() |