From 625f10a3d7ac5bc7ecdb03f1c67c611b15606690 Mon Sep 17 00:00:00 2001 From: moson-mo Date: Sat, 13 May 2023 11:20:14 +0200 Subject: [PATCH] fix: correct some color glitches Signed-off-by: moson-mo --- internal/pacseek/draw.go | 9 ++++++--- internal/pacseek/setup.go | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/pacseek/draw.go b/internal/pacseek/draw.go index 4aae638..a183511 100644 --- a/internal/pacseek/draw.go +++ b/internal/pacseek/draw.go @@ -508,7 +508,7 @@ func (ps *UI) drawPackageListContent(packages []Package, pkgwidth int) { ps.tablePackages.SetCell(i+1, 0, &tview.TableCell{ Text: pkg.Name, Color: tcell.ColorWhite, - BackgroundColor: tcell.ColorBlack, + BackgroundColor: ps.conf.Colors().DefaultBackground, MaxWidth: pkgwidth, }). SetCell(i+1, 1, &tview.TableCell{ @@ -517,6 +517,7 @@ func (ps *UI) drawPackageListContent(packages []Package, pkgwidth int) { BackgroundColor: ps.conf.Colors().DefaultBackground, }). SetCell(i+1, 2, &tview.TableCell{ + Color: ps.conf.Colors().DefaultBackground, Text: ps.getInstalledStateText(pkg.IsInstalled), Expansion: 1000, Reference: pkg.IsInstalled, @@ -765,9 +766,11 @@ func (ps *UI) getInstalledStateText(isInstalled bool) string { colStrInstalled = "[white:black:b]" } - ret := "[white:black:-]" + glyphs.PrefixState + colStrInstalled + installed + "[white:black:-]" + glyphs.SuffixState + whiteBlack := "[white:black:-]" if ps.conf.Colors().DefaultBackground == tcell.ColorDefault { - ret = strings.Replace(ret, ":black:", ":-:", -1) + whiteBlack = "[white:-:-]" } + ret := whiteBlack + glyphs.PrefixState + colStrInstalled + installed + whiteBlack + glyphs.SuffixState + return ret } diff --git a/internal/pacseek/setup.go b/internal/pacseek/setup.go index 323793a..43adafe 100644 --- a/internal/pacseek/setup.go +++ b/internal/pacseek/setup.go @@ -99,6 +99,7 @@ func (ps *UI) applyColors() { ps.textPkgbuild.SetTitleColor(ps.conf.Colors().Title).SetBackgroundColor(ps.conf.Colors().DefaultBackground) ps.tableNews.SetTitleColor(ps.conf.Colors().Title).SetBackgroundColor(ps.conf.Colors().DefaultBackground) ps.tablePackages.SetBackgroundColor(ps.conf.Colors().DefaultBackground) + ps.tablePackages.SetSelectedStyle(tcell.StyleDefault.Reverse(true)) ps.spinner.SetBackgroundColor(ps.conf.Colors().DefaultBackground) // settings form @@ -112,14 +113,22 @@ func (ps *UI) applyColors() { // package list ps.drawPackageListHeader(ps.conf.PackageColumnWidth) for i := 1; i < ps.tablePackages.GetRowCount(); i++ { - c := ps.tablePackages.GetCell(i, 1) + // Package + c := ps.tablePackages.GetCell(i, 0) + c.SetBackgroundColor(ps.conf.Colors().DefaultBackground) + + // Source + c = ps.tablePackages.GetCell(i, 1) col := ps.conf.Colors().PackagelistSourceRepository if c.Text == "AUR" { col = ps.conf.Colors().PackagelistSourceAUR } c.SetTextColor(col) c.SetBackgroundColor(ps.conf.Colors().DefaultBackground) + + // Installed c = ps.tablePackages.GetCell(i, 2) + c.SetTextColor(ps.conf.Colors().DefaultBackground) c.SetText(ps.getInstalledStateText(c.Reference.(bool))) }