Skip to content

Commit

Permalink
fix: correct some color glitches
Browse files Browse the repository at this point in the history
Signed-off-by: moson-mo <[email protected]>
  • Loading branch information
moson-mo committed May 13, 2023
1 parent e8a0735 commit 625f10a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 6 additions & 3 deletions internal/pacseek/draw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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
}
11 changes: 10 additions & 1 deletion internal/pacseek/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)))
}

Expand Down

0 comments on commit 625f10a

Please sign in to comment.