es2020 or smth

This commit is contained in:
Flummi 2024-01-20 04:55:08 +01:00
parent de0ae352cb
commit bd243ec115
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817

View File

@ -3,23 +3,17 @@ const colors = [
'#718d00', '#6fa100', '#5c8000', '#498000', '#080' '#718d00', '#6fa100', '#5c8000', '#498000', '#080'
]; ];
function batteryColor(batteryPercent) { const batteryColor = batteryPercent => colors[({
return colors[({ "-2": 9,
"-2": 9, "-1": 0
"-1": 0 })[batteryPercent] ?? ~~(batteryPercent / 10 + 0.5) - 1];
})[batteryPercent] ?? ~~(batteryPercent / 10 + 0.5) - 1];
}
function batteryLevel(batteryPercent) { const batteryLevel = batteryPercent => ({
return ({ "-2": "not connected",
"-2": "not connected", "-1": "charging"
"-1": "charging" })[batteryPercent] ?? batteryPercent + "%";
})[batteryPercent] ?? batteryPercent + "%";
}
function batteryIcon(batteryPercent) { const batteryIcon = batteryPercent => ({
return ({ "-2": "action-unavailable",
"-2": "action-unavailable", "-1": "battery-ac-adapter"
"-1": "battery-ac-adapter" })[batteryPercent] ?? "audio-headphones-symbolic";
})[batteryPercent] ?? "audio-headphones-symbolic";
}