weather: Tweak bangle 2 light theme colors
parent
6b2f8e98d3
commit
e56be81f8f
|
|
@ -824,7 +824,7 @@
|
||||||
{
|
{
|
||||||
"id": "weather",
|
"id": "weather",
|
||||||
"name": "Weather",
|
"name": "Weather",
|
||||||
"version": "0.12",
|
"version": "0.13",
|
||||||
"description": "Show Gadgetbridge weather report",
|
"description": "Show Gadgetbridge weather report",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [{"url":"screenshot.png"}],
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,4 @@
|
||||||
0.10: Use new Layout library
|
0.10: Use new Layout library
|
||||||
0.11: Bangle.js 2 support
|
0.11: Bangle.js 2 support
|
||||||
0.12: Allow hiding the widget
|
0.12: Allow hiding the widget
|
||||||
|
0.13: Tweak Bangle.js 2 light theme colors
|
||||||
|
|
|
||||||
|
|
@ -54,14 +54,62 @@ exports.get = function() {
|
||||||
scheduleExpiry(storage.readJSON('weather.json')||{});
|
scheduleExpiry(storage.readJSON('weather.json')||{});
|
||||||
|
|
||||||
exports.drawIcon = function(cond, x, y, r) {
|
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) {
|
function drawSun(x, y, r) {
|
||||||
g.setColor(B2 ? '#FF0' : (g.theme.dark ? "#FE0" : "#FC0"));
|
g.setColor(palette.sun);
|
||||||
g.fillCircle(x, y, r);
|
g.fillCircle(x, y, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCloud(x, y, r, c) {
|
function drawCloud(x, y, r, c) {
|
||||||
const u = r/12;
|
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.setColor(c);
|
||||||
g.fillCircle(x-8*u, y+3*u, 4*u);
|
g.fillCircle(x-8*u, y+3*u, 4*u);
|
||||||
g.fillCircle(x-4*u, y-2*u, 5*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) {
|
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);
|
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) {
|
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 y1 = y+1/2*r;
|
||||||
const y2 = y+1*r;
|
const y2 = y+1*r;
|
||||||
const poly = g.fillPolyAA ? p => g.fillPolyAA(p) : p => g.fillPoly(p);
|
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 drawThunderstorm(x, y, r) {
|
||||||
function drawLightning(x, y, r) {
|
function drawLightning(x, y, r) {
|
||||||
g.setColor(B2 ? '#FF0' : (g.theme.dark ? "#FE0" : "#FC0"));
|
g.setColor(palette.lightning);
|
||||||
g.fillPoly([
|
g.fillPoly([
|
||||||
x-2/6*r, y-r,
|
x-2/6*r, y-r,
|
||||||
x-4/6*r, y+1/6*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;
|
const w = 1/12*r;
|
||||||
for(let i = 0; i<=6; ++i) {
|
for(let i = 0; i<=6; ++i) {
|
||||||
const points = [
|
const points = [
|
||||||
|
|
@ -187,7 +235,7 @@ exports.drawIcon = function(cond, x, y, r) {
|
||||||
[-0.2, 0.3],
|
[-0.2, 0.3],
|
||||||
];
|
];
|
||||||
|
|
||||||
g.setColor(B2 ? '#FFF' : (g.theme.dark ? "#FFF" : "#CCC"));
|
g.setColor(palette.mist);
|
||||||
for(let i = 0; i<5; ++i) {
|
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,
|
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);
|
y+(0.4*i-0.7)*r-1);
|
||||||
|
|
@ -197,7 +245,7 @@ exports.drawIcon = function(cond, x, y, r) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawUnknown(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);
|
g.setColor(g.theme.fg).setFontAlign(0, 0).setFont('Vector', r*2).drawString("?", x+r/10, y+r/6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue