Vertical Battery Widget: make color depend on level
parent
0ce0b9e22b
commit
66e4a01bf1
|
|
@ -14,6 +14,10 @@ WIDGETS["batv"]={area:"tr",width:14,draw:function() {
|
||||||
} else {
|
} else {
|
||||||
g.clearRect(x,y,x+14,y+24);
|
g.clearRect(x,y,x+14,y+24);
|
||||||
g.setColor(g.theme.fg).fillRect(x+2,y+2,x+12,y+22).clearRect(x+4,y+4,x+10,y+20).fillRect(x+5,y+1,x+9,y+2);
|
g.setColor(g.theme.fg).fillRect(x+2,y+2,x+12,y+22).clearRect(x+4,y+4,x+10,y+20).fillRect(x+5,y+1,x+9,y+2);
|
||||||
g.setColor("#0f0").fillRect(x+4,y+20-(E.getBattery()*16/100),x+10,y+20);
|
var battery = E.getBattery();
|
||||||
|
if (battery < 20) {g.setColor("#f00");}
|
||||||
|
else if (battery < 40) {g.setColor(g.theme.dark ? "#ff0" : "#f80");}
|
||||||
|
else {g.setColor("#0f0");}
|
||||||
|
g.fillRect(x+4,y+20-(E.getBattery()*16/100),x+10,y+20);
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue