From 3f903c796c26f17bfd7ee1129b94863fcb38ddfd Mon Sep 17 00:00:00 2001 From: Quan Tong Date: Sat, 26 Mar 2022 15:09:34 +0700 Subject: [PATCH] Fixes #174: different colors for download/upload --- cmd/gotop/description.txt | 2 +- colorschemes/default.go | 2 +- colorschemes/default.json | 2 +- colorschemes/default_dark.go | 2 +- colorschemes/monokai.go | 2 +- colorschemes/nord.go | 2 +- colorschemes/solarized.go | 2 +- colorschemes/solarized16_dark.go | 2 +- colorschemes/solarized16_light.go | 2 +- colorschemes/template.go | 4 ++-- colorschemes/vice.go | 2 +- layout/layout.go | 5 +++-- 12 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cmd/gotop/description.txt b/cmd/gotop/description.txt index eb038eb..63ceff7 100644 --- a/cmd/gotop/description.txt +++ b/cmd/gotop/description.txt @@ -20,7 +20,7 @@ The keys are: BattLines -- array of ints for the colors of lines MemLines -- array of ints for the colors of lines ProcCursor -- int, color of the cursor in the process widget - Sparkline -- int, color of the graph bars + Sparklines -- array of ints for the colors of network usage DiskBar -- int, color of the disk bars TempLow -- int, color used for low temperatures TempHigh -- int, color used for high temperatures diff --git a/colorschemes/default.go b/colorschemes/default.go index 90ac3fa..10e9fcd 100644 --- a/colorschemes/default.go +++ b/colorschemes/default.go @@ -16,7 +16,7 @@ func init() { ProcCursor: 4, - Sparkline: 4, + Sparklines: [2]int{4, 5}, DiskBar: 7, diff --git a/colorschemes/default.json b/colorschemes/default.json index d6b3dc5..ec60e8e 100644 --- a/colorschemes/default.json +++ b/colorschemes/default.json @@ -15,7 +15,7 @@ "ProcCursor": 4, - "Sparkline": 4, + "Sparklines": [4, 5], "DiskBar": 7, diff --git a/colorschemes/default_dark.go b/colorschemes/default_dark.go index 7f7911c..72a2d05 100644 --- a/colorschemes/default_dark.go +++ b/colorschemes/default_dark.go @@ -16,7 +16,7 @@ func init() { ProcCursor: 33, - Sparkline: 4, + Sparklines: [2]int{4, 5}, DiskBar: 252, diff --git a/colorschemes/monokai.go b/colorschemes/monokai.go index d09f3c9..989234c 100644 --- a/colorschemes/monokai.go +++ b/colorschemes/monokai.go @@ -16,7 +16,7 @@ func init() { ProcCursor: 197, - Sparkline: 81, + Sparklines: [2]int{81, 186}, DiskBar: 102, diff --git a/colorschemes/nord.go b/colorschemes/nord.go index 028057e..47059d6 100644 --- a/colorschemes/nord.go +++ b/colorschemes/nord.go @@ -29,7 +29,7 @@ func init() { ProcCursor: 31, // blue (nord9) - Sparkline: 31, + Sparklines: [2]int{31, 96}, DiskBar: 254, diff --git a/colorschemes/solarized.go b/colorschemes/solarized.go index 4649d93..90589e4 100644 --- a/colorschemes/solarized.go +++ b/colorschemes/solarized.go @@ -19,7 +19,7 @@ func init() { ProcCursor: 136, - Sparkline: 33, + Sparklines: [2]int{33, 136}, DiskBar: 243, diff --git a/colorschemes/solarized16_dark.go b/colorschemes/solarized16_dark.go index 00c7eb6..1977ae2 100644 --- a/colorschemes/solarized16_dark.go +++ b/colorschemes/solarized16_dark.go @@ -18,7 +18,7 @@ func init() { ProcCursor: 4, - Sparkline: 4, + Sparklines: [2]int{4, 5}, DiskBar: 12, // base0 diff --git a/colorschemes/solarized16_light.go b/colorschemes/solarized16_light.go index b4157d9..b912a06 100644 --- a/colorschemes/solarized16_light.go +++ b/colorschemes/solarized16_light.go @@ -18,7 +18,7 @@ func init() { ProcCursor: 4, - Sparkline: 4, + Sparklines: [2]int{4, 5}, DiskBar: 11, // base00 diff --git a/colorschemes/template.go b/colorschemes/template.go index 514a063..b2a0b3f 100644 --- a/colorschemes/template.go +++ b/colorschemes/template.go @@ -52,8 +52,8 @@ type Colorscheme struct { // ProcCursor is used as the color for the color bar in the process widget ProcCursor int - // SparkLine determines the color of the data line in spark graphs - Sparkline int + // SparkLines define the colors used for the Network usage graphs + Sparklines [2]int // DiskBar is the color of the disk gauge bars (currently unused, // as there's no disk gauge widget) diff --git a/colorschemes/vice.go b/colorschemes/vice.go index d0dbb03..f5e42e2 100644 --- a/colorschemes/vice.go +++ b/colorschemes/vice.go @@ -16,7 +16,7 @@ func init() { ProcCursor: 159, - Sparkline: 183, + Sparklines: [2]int{183, 146}, DiskBar: 158, diff --git a/layout/layout.go b/layout/layout.go index 6ae2612..8855aa7 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/xxxserxxx/lingo/v2" + "github.com/xxxserxxx/gotop/v4" "github.com/xxxserxxx/gotop/v4/widgets" @@ -186,9 +187,9 @@ func makeWidget(c gotop.Config, widRule widgetRule) interface{} { w = t case "net": n := widgets.NewNetWidget(c.NetInterface) - n.Lines[0].LineColor = ui.Color(c.Colorscheme.Sparkline) + n.Lines[0].LineColor = ui.Color(c.Colorscheme.Sparklines[0]) n.Lines[0].TitleColor = ui.Color(c.Colorscheme.BorderLabel) - n.Lines[1].LineColor = ui.Color(c.Colorscheme.Sparkline) + n.Lines[1].LineColor = ui.Color(c.Colorscheme.Sparklines[1]) n.Lines[1].TitleColor = ui.Color(c.Colorscheme.BorderLabel) n.Mbps = c.Mbps w = n