Skip to content

Commit

Permalink
cjbassi#137 feat: added so we switch to static colors if there isn't …
Browse files Browse the repository at this point in the history
…enough with colors in the cpulines, not sure if you would like todo something like this, but in my mind the important thing is uniqueness of the CPU cores, so there isnt 2 CPU cores with same color, cause then its really hard to see the graph, but not sure this is the best way todo it, just a suggestion :)
  • Loading branch information
Tazer committed May 2, 2019
1 parent 21cd642 commit 830ee75
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,19 @@ func setWidgetColors() {
}
sort.Strings(keys)
i := 0
automaticcolors := false

if len(keys) > len(colorscheme.CPULines) {
automaticcolors = true
}

for _, v := range keys {
if i >= len(colorscheme.CPULines) {
// assuming colorscheme for CPU lines is not empty
i = 0
if automaticcolors {
cpu.LineColors[v] = ui.Color(i + 1)
} else {
c := colorscheme.CPULines[i]
cpu.LineColors[v] = ui.Color(c)
}
c := colorscheme.CPULines[i]
cpu.LineColors[v] = ui.Color(c)
i++
}

Expand Down

0 comments on commit 830ee75

Please sign in to comment.