diff --git a/apps.json b/apps.json index fd2e14e60..8154b80da 100644 --- a/apps.json +++ b/apps.json @@ -824,7 +824,7 @@ { "id": "weather", "name": "Weather", - "version": "0.12", + "version": "0.13", "description": "Show Gadgetbridge weather report", "icon": "icon.png", "screenshots": [{"url":"screenshot.png"}], diff --git a/apps/weather/ChangeLog b/apps/weather/ChangeLog index 95f943e6d..fb6b28bf6 100644 --- a/apps/weather/ChangeLog +++ b/apps/weather/ChangeLog @@ -9,3 +9,4 @@ 0.10: Use new Layout library 0.11: Bangle.js 2 support 0.12: Allow hiding the widget +0.13: Tweak Bangle.js 2 light theme colors diff --git a/apps/weather/lib.js b/apps/weather/lib.js index 76ed2aaa4..7cb9a9f9b 100644 --- a/apps/weather/lib.js +++ b/apps/weather/lib.js @@ -54,14 +54,62 @@ exports.get = function() { scheduleExpiry(storage.readJSON('weather.json')||{}); exports.drawIcon = function(cond, x, y, r) { + var palette; + + if (B2) { + if (g.theme.dark) { + palette = { + sun: '#FF0', + cloud: '#FFF', + bgCloud: '#777', // dithers on B2, but that's ok + rain: '#0FF', + lightning: '#FF0', + snow: '#FFF', + mist: '#FFF' + }; + } else { + palette = { + sun: '#FF0', + cloud: '#777', // dithers on B2, but that's ok + bgCloud: '#000', + rain: '#00F', + lightning: '#FF0', + snow: '#0FF', + mist: '#0FF' + }; + } + } else { + if (g.theme.dark) { + palette = { + sun: '#FE0', + cloud: '#BBB', + bgCloud: '#777', + rain: '#0CF', + lightning: '#FE0', + snow: '#FFF', + mist: '#FFF' + }; + } else { + palette = { + sun: '#FC0', + cloud: '#000', + bgCloud: '#777', + rain: '#07F', + lightning: '#FC0', + snow: '#CCC', + mist: '#CCC' + }; + } + } + function drawSun(x, y, r) { - g.setColor(B2 ? '#FF0' : (g.theme.dark ? "#FE0" : "#FC0")); + g.setColor(palette.sun); g.fillCircle(x, y, r); } function drawCloud(x, y, r, c) { const u = r/12; - if (c==null) c = B2 ? '#FFF': (g.theme.dark ? "#BBB" : "#AAA"); + if (c==null) c = palette.cloud; g.setColor(c); g.fillCircle(x-8*u, y+3*u, 4*u); g.fillCircle(x-4*u, y-2*u, 5*u); @@ -78,7 +126,7 @@ exports.drawIcon = function(cond, x, y, r) { } function drawBrokenClouds(x, y, r) { - drawCloud(x+1/8*r, y-1/8*r, 7/8*r, "#777"); // dithers on B2, but that's ok + drawCloud(x+1/8*r, y-1/8*r, 7/8*r, palette.bgCloud); drawCloud(x-1/8*r, y+1/8*r, 7/8*r); } @@ -88,7 +136,7 @@ exports.drawIcon = function(cond, x, y, r) { } function drawRainLines(x, y, r) { - g.setColor(B2 ? '#0FF' : (g.theme.dark ? "#0CF" : "#07F")); + g.setColor(palette.rain); const y1 = y+1/2*r; const y2 = y+1*r; const poly = g.fillPolyAA ? p => g.fillPolyAA(p) : p => g.fillPoly(p); @@ -124,7 +172,7 @@ exports.drawIcon = function(cond, x, y, r) { function drawThunderstorm(x, y, r) { function drawLightning(x, y, r) { - g.setColor(B2 ? '#FF0' : (g.theme.dark ? "#FE0" : "#FC0")); + g.setColor(palette.lightning); g.fillPoly([ x-2/6*r, y-r, x-4/6*r, y+1/6*r, @@ -152,7 +200,7 @@ exports.drawIcon = function(cond, x, y, r) { } } - g.setColor(B2 ? '#FFF' : (g.theme.dark ? "#FFF" : "#CCC")); + g.setColor(palette.snow); const w = 1/12*r; for(let i = 0; i<=6; ++i) { const points = [ @@ -187,7 +235,7 @@ exports.drawIcon = function(cond, x, y, r) { [-0.2, 0.3], ]; - g.setColor(B2 ? '#FFF' : (g.theme.dark ? "#FFF" : "#CCC")); + g.setColor(palette.mist); for(let i = 0; i<5; ++i) { g.fillRect(x+layers[i][0]*r, y+(0.4*i-0.9)*r, x+layers[i][1]*r, y+(0.4*i-0.7)*r-1); @@ -197,7 +245,7 @@ exports.drawIcon = function(cond, x, y, r) { } function drawUnknown(x, y, r) { - drawCloud(x, y, r, "#777"); // dithers on B2, but that's ok + drawCloud(x, y, r, palette.bgCloud); g.setColor(g.theme.fg).setFontAlign(0, 0).setFont('Vector', r*2).drawString("?", x+r/10, y+r/6); }