Solarized theme fixes

The Solarized theme doesn't work well on light themes. (Light/dark have
identical palettes, but the foreground/background colors are different
and greys obviously get used differently.)

This commit makes the 'solarized' theme use the foreground color instead
of '250' and use the average of base00 and base0 for DiskBar. (These
greys are already close to 50%.)

This commit also adds two 16-color themes utilizing the extra violet/
orange colors, and uses the appropriate grey color for DiskBar.
This commit is contained in:
Markus Peloquin 2019-11-15 16:23:32 -08:00 committed by Sean E. Russell
parent 0932e3c3d0
commit 44b8ac9c1a
6 changed files with 68 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
dist/
gotop
/gotop
# snap packaging specific
/parts/

View File

@ -64,6 +64,8 @@ Colorschemes:
default
default-dark (for white background)
solarized
solarized16-dark
solarized16-light
monokai
vice
`
@ -147,6 +149,10 @@ func handleColorscheme(c string) (colorschemes.Colorscheme, error) {
cs = colorschemes.Default
case "solarized":
cs = colorschemes.Solarized
case "solarized16-light":
cs = colorschemes.Solarized16Light
case "solarized16-dark":
cs = colorschemes.Solarized16Dark
case "monokai":
cs = colorschemes.Monokai
case "vice":

View File

@ -1,10 +1,13 @@
package colorschemes
// This is a neutral version of the Solarized 256-color palette. The exception
// is that the one grey color uses the average of base0 and base00, which are
// already middle of the road.
var Solarized = Colorscheme{
Fg: 250,
Fg: -1,
Bg: -1,
BorderLabel: 250,
BorderLabel: -1,
BorderLine: 37,
CPULines: []int{61, 33, 37, 64, 125, 160, 166, 136},
@ -18,7 +21,7 @@ var Solarized = Colorscheme{
Sparkline: 33,
DiskBar: 245,
DiskBar: 243,
TempLow: 64,
TempHigh: 160,

View File

@ -0,0 +1,27 @@
package colorschemes
// This scheme assumes the terminal already uses Solarized. Only DiskBar is
// different between dark/light.
var Solarized16Dark = Colorscheme{
Fg: -1,
Bg: -1,
BorderLabel: -1,
BorderLine: 6,
CPULines: []int{13, 4, 6, 2, 5, 1, 9, 3},
BattLines: []int{13, 4, 6, 2, 5, 1, 9, 3},
MainMem: 5,
SwapMem: 9,
ProcCursor: 4,
Sparkline: 4,
DiskBar: 12, // base0
TempLow: 2,
TempHigh: 1,
}

View File

@ -0,0 +1,27 @@
package colorschemes
// This scheme assumes the terminal already uses Solarized. Only DiskBar is
// different between dark/light.
var Solarized16Light = Colorscheme{
Fg: -1,
Bg: -1,
BorderLabel: -1,
BorderLine: 6,
CPULines: []int{13, 4, 6, 2, 5, 1, 9, 3},
BattLines: []int{13, 4, 6, 2, 5, 1, 9, 3},
MainMem: 5,
SwapMem: 9,
ProcCursor: 4,
Sparkline: 4,
DiskBar: 11, // base00
TempLow: 2,
TempHigh: 1,
}

View File

@ -29,6 +29,7 @@ type MyGrid struct {
var widgetNames []string = []string{"cpu", "disk", "mem", "temp", "net", "procs", "batt"}
// BUG 2:disk mem\nnet loses the widget from the second line
func Layout(wl layout, c gotop.Config) (*MyGrid, error) {
rowDefs := wl.Rows
uiRows := make([]ui.GridItem, 0)