Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

#137 feat: added so we switch to static colors if there isn't enough … #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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