es2020 or smth
This commit is contained in:
parent
de0ae352cb
commit
bd243ec115
|
@ -3,23 +3,17 @@ const colors = [
|
|||
'#718d00', '#6fa100', '#5c8000', '#498000', '#080'
|
||||
];
|
||||
|
||||
function batteryColor(batteryPercent) {
|
||||
return colors[({
|
||||
const batteryColor = batteryPercent => colors[({
|
||||
"-2": 9,
|
||||
"-1": 0
|
||||
})[batteryPercent] ?? ~~(batteryPercent / 10 + 0.5) - 1];
|
||||
}
|
||||
|
||||
function batteryLevel(batteryPercent) {
|
||||
return ({
|
||||
const batteryLevel = batteryPercent => ({
|
||||
"-2": "not connected",
|
||||
"-1": "charging"
|
||||
})[batteryPercent] ?? batteryPercent + "%";
|
||||
}
|
||||
|
||||
function batteryIcon(batteryPercent) {
|
||||
return ({
|
||||
const batteryIcon = batteryPercent => ({
|
||||
"-2": "action-unavailable",
|
||||
"-1": "battery-ac-adapter"
|
||||
})[batteryPercent] ?? "audio-headphones-symbolic";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user