Merge pull request #559 from somospocos/cpu2-themecolors

Cpu2 themecolors
This commit is contained in:
tobi-wan-kenobi 2020-02-20 20:45:43 +01:00 committed by GitHub
commit c4df758240
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -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

View file

@ -1,5 +1,11 @@
{ {
"icons": [ "awesome-fonts" ], "icons": [ "awesome-fonts" ],
"colors": [{
"red": "#BF616A",
"orange": "#D08770",
"yellow": "#EBCB8B",
"green": "#A3BE8C"
}],
"defaults": { "defaults": {
"separator-block-width": 0, "separator-block-width": 0,
"warning": { "warning": {