Skip to content

Commit 7f7685b

Browse files
committed
More tweaks to Battery Percentage colour changes
1 parent aeef91f commit 7f7685b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/lib/util.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ const icons: Record<string, icon> = {
2222
iconName: 'battery.25percent',
2323
color: Color.red(),
2424
},
25-
'battery.50.green': {
25+
'battery.25.orange': {
26+
iconName: 'battery.25percent',
27+
color: Color.orange(),
28+
},
29+
'battery.50': {
2630
iconName: 'battery.50percent',
2731
color: Color.green(),
2832
},
@@ -148,9 +152,9 @@ export function getChargeCompletionString(
148152
}
149153

150154
export function getBatteryPercentColor(batteryPercent: number): Color {
151-
if (batteryPercent >= 45) {
155+
if (batteryPercent >= 40) {
152156
return Color.green()
153-
} else if (batteryPercent >= 35) {
157+
} else if (batteryPercent >= 20) {
154158
return Color.orange()
155159
}
156160
return Color.red()
@@ -213,12 +217,14 @@ export function calculateBatteryIcon(batteryPercent: number): string {
213217
percentRounded = 100
214218
} else if (batteryPercent >= 65) {
215219
percentRounded = 75
216-
} else if (batteryPercent >= 45) {
220+
} else if (batteryPercent >= 40) {
217221
percentRounded = 50
218-
colorExtra = '.green'
219222
} else if (batteryPercent >= 35) {
220223
percentRounded = 50
221224
colorExtra = '.orange'
225+
} else if (batteryPercent >= 20) {
226+
percentRounded = 25
227+
colorExtra = '.orange'
222228
} else if (batteryPercent >= 15) {
223229
percentRounded = 25
224230
}

0 commit comments

Comments
 (0)