From 6bf64841d381460f1e44adecd42132080d07fac9 Mon Sep 17 00:00:00 2001 From: Zdenek Crha Date: Mon, 21 Sep 2020 12:11:39 +0200 Subject: [PATCH] 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. --- termui/help_bar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/termui/help_bar.go b/termui/help_bar.go index 78f8ebca733729b15317b05372c206e55b211b50..9fc7c152356dc5299778888adb88d58ed0a92440 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()