fix 100% charge lol
This commit is contained in:
parent
ef3ed2726b
commit
b15a5946a7
@ -29,7 +29,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
color: Helper.interpolateColor(parseFloat("." + batteryPercent), [ colorEmpty, colorHalf, colorFull ])
|
||||
color: Helper.interpolateColor(batteryPercent / 100, [ colorEmpty, colorHalf, colorFull ])
|
||||
width: parent.width * Math.max(0, Math.min(batteryPercent, 100)) / 100
|
||||
}
|
||||
Kirigami.Icon { // headphones icon
|
||||
|
@ -14,7 +14,7 @@ const rgb2Hex = rgb => "#" + ((1 << 24) + (rgb.r << 16) + (rgb.g << 8) + rgb.b).
|
||||
const interpolateColor = (f, c) => {
|
||||
if(!f) return "transparent";
|
||||
if(f >= 1) return c.pop();
|
||||
if(f <= 0) return c[0];
|
||||
if(f <= 0) return c.shift();
|
||||
|
||||
f *= c.length - 1;
|
||||
const i = ~~f;
|
||||
|
Loading…
Reference in New Issue
Block a user