Skip to content

Commit 625f10a

Browse files
committed
fix: correct some color glitches
Signed-off-by: moson-mo <mo-son@mailbox.org>
1 parent e8a0735 commit 625f10a

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

internal/pacseek/draw.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ func (ps *UI) drawPackageListContent(packages []Package, pkgwidth int) {
508508
ps.tablePackages.SetCell(i+1, 0, &tview.TableCell{
509509
Text: pkg.Name,
510510
Color: tcell.ColorWhite,
511-
BackgroundColor: tcell.ColorBlack,
511+
BackgroundColor: ps.conf.Colors().DefaultBackground,
512512
MaxWidth: pkgwidth,
513513
}).
514514
SetCell(i+1, 1, &tview.TableCell{
@@ -517,6 +517,7 @@ func (ps *UI) drawPackageListContent(packages []Package, pkgwidth int) {
517517
BackgroundColor: ps.conf.Colors().DefaultBackground,
518518
}).
519519
SetCell(i+1, 2, &tview.TableCell{
520+
Color: ps.conf.Colors().DefaultBackground,
520521
Text: ps.getInstalledStateText(pkg.IsInstalled),
521522
Expansion: 1000,
522523
Reference: pkg.IsInstalled,
@@ -765,9 +766,11 @@ func (ps *UI) getInstalledStateText(isInstalled bool) string {
765766
colStrInstalled = "[white:black:b]"
766767
}
767768

768-
ret := "[white:black:-]" + glyphs.PrefixState + colStrInstalled + installed + "[white:black:-]" + glyphs.SuffixState
769+
whiteBlack := "[white:black:-]"
769770
if ps.conf.Colors().DefaultBackground == tcell.ColorDefault {
770-
ret = strings.Replace(ret, ":black:", ":-:", -1)
771+
whiteBlack = "[white:-:-]"
771772
}
773+
ret := whiteBlack + glyphs.PrefixState + colStrInstalled + installed + whiteBlack + glyphs.SuffixState
774+
772775
return ret
773776
}

internal/pacseek/setup.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func (ps *UI) applyColors() {
9999
ps.textPkgbuild.SetTitleColor(ps.conf.Colors().Title).SetBackgroundColor(ps.conf.Colors().DefaultBackground)
100100
ps.tableNews.SetTitleColor(ps.conf.Colors().Title).SetBackgroundColor(ps.conf.Colors().DefaultBackground)
101101
ps.tablePackages.SetBackgroundColor(ps.conf.Colors().DefaultBackground)
102+
ps.tablePackages.SetSelectedStyle(tcell.StyleDefault.Reverse(true))
102103
ps.spinner.SetBackgroundColor(ps.conf.Colors().DefaultBackground)
103104

104105
// settings form
@@ -112,14 +113,22 @@ func (ps *UI) applyColors() {
112113
// package list
113114
ps.drawPackageListHeader(ps.conf.PackageColumnWidth)
114115
for i := 1; i < ps.tablePackages.GetRowCount(); i++ {
115-
c := ps.tablePackages.GetCell(i, 1)
116+
// Package
117+
c := ps.tablePackages.GetCell(i, 0)
118+
c.SetBackgroundColor(ps.conf.Colors().DefaultBackground)
119+
120+
// Source
121+
c = ps.tablePackages.GetCell(i, 1)
116122
col := ps.conf.Colors().PackagelistSourceRepository
117123
if c.Text == "AUR" {
118124
col = ps.conf.Colors().PackagelistSourceAUR
119125
}
120126
c.SetTextColor(col)
121127
c.SetBackgroundColor(ps.conf.Colors().DefaultBackground)
128+
129+
// Installed
122130
c = ps.tablePackages.GetCell(i, 2)
131+
c.SetTextColor(ps.conf.Colors().DefaultBackground)
123132
c.SetText(ps.getInstalledStateText(c.Reference.(bool)))
124133
}
125134

0 commit comments

Comments
 (0)