widbars - Set battery bar color on load

pull/2239/head
Martin Boonk 2022-11-06 01:45:53 +01:00
parent 5c110a89fb
commit a06f8d28a6
3 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
0.01: New Widget! 0.01: New Widget!
0.02: Battery bar turns yellow on charge 0.02: Battery bar turns yellow on charge
Memory status bar does not trigger garbage collect Memory status bar does not trigger garbage collect
0.03: Set battery color on load

View File

@ -1,7 +1,7 @@
{ {
"id": "widbars", "id": "widbars",
"name": "Bars Widget", "name": "Bars Widget",
"version": "0.02", "version": "0.03",
"description": "Display several measurements as vertical bars.", "description": "Display several measurements as vertical bars.",
"icon": "icon.png", "icon": "icon.png",
"screenshots": [{"url":"screenshot.png"}], "screenshots": [{"url":"screenshot.png"}],

View File

@ -42,7 +42,7 @@
if (top) g .clearRect(x,y, x+w-1,y+top-1); // erase above bar if (top) g .clearRect(x,y, x+w-1,y+top-1); // erase above bar
if (f) g.setColor(col).fillRect(x,y+top, x+w-1,y+h-1); // even for f=0.001 this is still 1 pixel high if (f) g.setColor(col).fillRect(x,y+top, x+w-1,y+h-1); // even for f=0.001 this is still 1 pixel high
} }
let batColor='#0f0'; let batColor=Bangle.isCharging()?'#ff0':'#0f0';
function draw() { function draw() {
g.reset(); g.reset();
const x = this.x, y = this.y, const x = this.x, y = this.y,