es2020 or smth
This commit is contained in:
parent
de0ae352cb
commit
bd243ec115
|
@ -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";
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user