Changed to follow system them with setting for dark theme
parent
5f34461991
commit
5353420ace
|
|
@ -7,4 +7,5 @@
|
||||||
0.06: Fix issue showing widgets when app is fast-loaded into from launcher with widgets disabled
|
0.06: Fix issue showing widgets when app is fast-loaded into from launcher with widgets disabled
|
||||||
0.07: Enable fast loading and queue updates to the second
|
0.07: Enable fast loading and queue updates to the second
|
||||||
0.08: Restore redraw on charging event + fixup for safer fast-loading
|
0.08: Restore redraw on charging event + fixup for safer fast-loading
|
||||||
0.09: Add setting to show the weekday and not the year + add setting to hide the battery
|
0.09: Add setting to show the weekday and not the year + add setting to hide the battery +
|
||||||
|
changed to follow system them with setting for dark theme
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,4 @@
|
||||||
* hour hand can be made slighly shorter to improve readability when minute hand is behind a number
|
* hour hand can be made slighly shorter to improve readability when minute hand is behind a number
|
||||||
* show the weekday and not the year
|
* show the weekday and not the year
|
||||||
* hide the battery percentage
|
* hide the battery percentage
|
||||||
|
* dark theme (enabled by default); disable to follow system theme
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,16 @@ const defaultSettings = {
|
||||||
textAboveHands : false,
|
textAboveHands : false,
|
||||||
shortHrHand : false,
|
shortHrHand : false,
|
||||||
weekdayNoYear : false,
|
weekdayNoYear : false,
|
||||||
noBattery : false
|
noBattery : false,
|
||||||
|
darkTheme : true
|
||||||
};
|
};
|
||||||
const settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{});
|
const settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{});
|
||||||
|
|
||||||
|
if (settings.darkTheme) {
|
||||||
|
g.setTheme({bg: "#000"});
|
||||||
|
g.setTheme({fg: "#FFF"});
|
||||||
|
}
|
||||||
|
|
||||||
const c={"x":g.getWidth()/2,"y":g.getHeight()/2};
|
const c={"x":g.getWidth()/2,"y":g.getHeight()/2};
|
||||||
|
|
||||||
const zahlpos=(function() {
|
const zahlpos=(function() {
|
||||||
|
|
@ -38,7 +44,7 @@ const zeiger = function(len,dia,tim) {
|
||||||
|
|
||||||
const drawHands = function(d) {
|
const drawHands = function(d) {
|
||||||
let m=d.getMinutes(), h=d.getHours(), s=d.getSeconds();
|
let m=d.getMinutes(), h=d.getHours(), s=d.getSeconds();
|
||||||
g.setColor(1,1,1);
|
g.setColor(g.theme.fg);
|
||||||
|
|
||||||
if(h>12){
|
if(h>12){
|
||||||
h=h-12;
|
h=h-12;
|
||||||
|
|
@ -64,8 +70,9 @@ const drawHands = function(d) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const drawText = function(d) {
|
const drawText = function(d) {
|
||||||
g.setBgColor(0,0,0);
|
//g.setFont("Vector",10);
|
||||||
g.setColor(1,1,1);
|
g.setBgColor(g.theme.bg);
|
||||||
|
g.setColor(g.theme.fg);
|
||||||
const dateStr = settings.weekdayNoYear
|
const dateStr = settings.weekdayNoYear
|
||||||
? require("locale").dow(d, 1)+" "+d.getDate()+" "+require("locale").month(d, 1)
|
? require("locale").dow(d, 1)+" "+d.getDate()+" "+require("locale").month(d, 1)
|
||||||
: require("locale").date(d);
|
: require("locale").date(d);
|
||||||
|
|
@ -86,8 +93,8 @@ const drawText = function(d) {
|
||||||
const drawNumbers = function() {
|
const drawNumbers = function() {
|
||||||
//draws the numbers on the screen
|
//draws the numbers on the screen
|
||||||
g.setFont("Vector",20);
|
g.setFont("Vector",20);
|
||||||
g.setColor(1,1,1);
|
g.setColor(g.theme.fg);
|
||||||
g.setBgColor(0,0,0);
|
g.setBgColor(g.theme.bg);
|
||||||
for(let i = 0;i<12;i++){
|
for(let i = 0;i<12;i++){
|
||||||
g.drawString(zahlpos[i][0],zahlpos[i][1],zahlpos[i][2],true);
|
g.drawString(zahlpos[i][0],zahlpos[i][1],zahlpos[i][2],true);
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +130,7 @@ const queueDraw = function() {
|
||||||
|
|
||||||
const draw = function() {
|
const draw = function() {
|
||||||
// draw black rectangle in the middle to clear screen from scale and hands
|
// draw black rectangle in the middle to clear screen from scale and hands
|
||||||
g.setColor(0,0,0);
|
g.setColor(g.theme.bg);
|
||||||
g.fillRect(10,10,2*c.x-10,2*c.x-10);
|
g.fillRect(10,10,2*c.x-10,2*c.x-10);
|
||||||
// prepare for drawing the text
|
// prepare for drawing the text
|
||||||
g.setFontAlign(0,0);
|
g.setFontAlign(0,0);
|
||||||
|
|
@ -141,7 +148,7 @@ const draw = function() {
|
||||||
//draws the scale once the app is startet
|
//draws the scale once the app is startet
|
||||||
const drawScale = function() {
|
const drawScale = function() {
|
||||||
// clear the screen
|
// clear the screen
|
||||||
g.setBgColor(0,0,0);
|
g.setBgColor(g.theme.bg);
|
||||||
g.clear();
|
g.clear();
|
||||||
// draw the ticks of the scale
|
// draw the ticks of the scale
|
||||||
for(let i=-14;i<47;i++){
|
for(let i=-14;i<47;i++){
|
||||||
|
|
@ -149,9 +156,9 @@ const drawScale = function() {
|
||||||
let d=2;
|
let d=2;
|
||||||
if(i%5==0){d=5;}
|
if(i%5==0){d=5;}
|
||||||
g.fillPoly(zeiger(300,d,win),true);
|
g.fillPoly(zeiger(300,d,win),true);
|
||||||
g.setColor(0,0,0);
|
g.setColor(g.theme.bg);
|
||||||
g.fillRect(10,10,2*c.x-10,2*c.x-10);
|
g.fillRect(10,10,2*c.x-10,2*c.x-10);
|
||||||
g.setColor(1,1,1);
|
g.setColor(g.theme.fg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
textAboveHands : false,
|
textAboveHands : false,
|
||||||
shortHrHand : false,
|
shortHrHand : false,
|
||||||
weekdayNoYear : false,
|
weekdayNoYear : false,
|
||||||
noBattery : false
|
noBattery : false,
|
||||||
|
darkTheme : true
|
||||||
}
|
}
|
||||||
let settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{});
|
let settings = Object.assign(defaultSettings, require('Storage').readJSON('andark.json',1)||{});
|
||||||
|
|
||||||
|
|
@ -32,6 +33,10 @@
|
||||||
value : !!settings.noBattery,
|
value : !!settings.noBattery,
|
||||||
onchange : v => { settings.noBattery=v; save();}
|
onchange : v => { settings.noBattery=v; save();}
|
||||||
},
|
},
|
||||||
|
/*LANG*/'Dark theme': {
|
||||||
|
value : !!settings.darkTheme,
|
||||||
|
onchange : v => { settings.darkTheme=v; save();}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
E.showMenu(appMenu);
|
E.showMenu(appMenu);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue