[modules/cpu2] use theme palette colors for core load bars
As discussed in #556. - added palette red, orange, yellow, green to nord-powerline - when used with nord-powerline (or any other theme that has these palette colors) and cpu2.colored=1, the cpu2 module will use these custom colors to display core load graphs; when colors are missing from a theme - it will use default colors
This commit is contained in:
parent
d0418446e1
commit
bf03ad7184
1 changed files with 5 additions and 6 deletions
|
@ -91,17 +91,16 @@ class Module(bumblebee.engine.Module):
|
||||||
def cpuload(self, _):
|
def cpuload(self, _):
|
||||||
return "{}%".format(self._cpuload)
|
return "{}%".format(self._cpuload)
|
||||||
|
|
||||||
@staticmethod
|
def add_color(self, bar):
|
||||||
def add_color(bar):
|
|
||||||
"""add color as pango markup to a bar"""
|
"""add color as pango markup to a bar"""
|
||||||
if bar in ["▁", "▂"]:
|
if bar in ["▁", "▂"]:
|
||||||
color = "green"
|
color = self.theme().color("green", "green")
|
||||||
elif bar in ["▃", "▄"]:
|
elif bar in ["▃", "▄"]:
|
||||||
color = "yellow"
|
color = self.theme().color("yellow", "yellow")
|
||||||
elif bar in ["▅", "▆"]:
|
elif bar in ["▅", "▆"]:
|
||||||
color = "orange"
|
color = self.theme().color("orange", "orange")
|
||||||
elif bar in ["▇", "█"]:
|
elif bar in ["▇", "█"]:
|
||||||
color = "red"
|
color = self.theme().color("red", "red")
|
||||||
colored_bar = "<span foreground='{}'>{}</span>".format(color, bar)
|
colored_bar = "<span foreground='{}'>{}</span>".format(color, bar)
|
||||||
return colored_bar
|
return colored_bar
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue