From 95779c15c500e3d610c7825a5a3cc2e4c971cbf2 Mon Sep 17 00:00:00 2001 From: eeeXun Date: Mon, 27 May 2024 23:18:55 +0800 Subject: [PATCH] Fix unselected list color --- list.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/list.go b/list.go index 8da6566..17ae3f2 100644 --- a/list.go +++ b/list.go @@ -506,12 +506,16 @@ func (l *List) Draw(screen tcell.Screen) { } // Main text. + var printedWidth int + var style tcell.Style selected := index == l.currentItem && (!l.selectedFocusOnly || l.HasFocus()) - style := l.mainTextStyle if selected { style = l.selectedStyle + _, _, printedWidth = printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, false) + } else { + style = l.mainTextStyle + _, _, printedWidth = printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, true) } - _, _, printedWidth := printWithStyle(screen, item.MainText, x, y, l.horizontalOffset, width, AlignLeft, style, false) if printedWidth > maxWidth { maxWidth = printedWidth }