fix 100% charge lol

This commit is contained in:
Flummi 2024-01-22 03:08:25 +01:00
parent ef3ed2726b
commit b15a5946a7
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817
2 changed files with 2 additions and 2 deletions

View File

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

View File

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