set theme to light, add black as an option for foreground color

master
Paul Arguillère 2024-03-28 11:27:36 +01:00
parent 650add7c84
commit 852e25b189
2 changed files with 31 additions and 27 deletions

View File

@ -36,6 +36,10 @@ switch (settings.foregroundColor) {
foregroundColor = COLOUR_WHITE; foregroundColor = COLOUR_WHITE;
break; break;
case 3:
foregroundColor = COLOUR_BLACK;
break;
default: default:
foregroundColor = COLOUR_BLACK; // to detect problems foregroundColor = COLOUR_BLACK; // to detect problems
break; break;
@ -144,7 +148,7 @@ function draw() {
} }
// Clear the screen once, at startup // Clear the screen once, at startup
g.setTheme({ bg: COLOUR_VPW_GREEN, fg: foregroundColor, dark: true }).clear(); g.setTheme({ bg: COLOUR_VPW_GREEN, fg: foregroundColor, dark: false }).clear();
// draw immediately at first, queue update // draw immediately at first, queue update
draw(); draw();
// Stop updates when LCD is off, restart when on // Stop updates when LCD is off, restart when on

View File

@ -1,28 +1,28 @@
(function(back) { (function(back) {
var FILE = "vpw_clock.settings.json"; var FILE = "vpw_clock.settings.json";
// Load settings // Load settings
var settings = Object.assign({ var settings = Object.assign({
foregroundColor: 0, foregroundColor: 0,
}, require('Storage').readJSON(FILE, true) || {}); }, require('Storage').readJSON(FILE, true) || {});
function writeSettings() { function writeSettings() {
require('Storage').writeJSON(FILE, settings); require('Storage').writeJSON(FILE, settings);
} }
var foregroundColors = ["Red", "Purple", "White"]; var foregroundColors = ["Red", "Purple", "White", "Black"];
// Show the menu // Show the menu
E.showMenu({ E.showMenu({
"" : { "title" : "Vaporwave Sunset" }, "" : { "title" : "Vaporwave Sunset" },
"< Back" : () => back(), "< Back" : () => back(),
'Foreground color': { 'Foreground color': {
value: 0|settings.foregroundColor, // 0| converts undefined to 0 value: 0|settings.foregroundColor, // 0| converts undefined to 0
min: 0, max: 2, min: 0, max: 3,
onchange: v => { onchange: v => {
settings.foregroundColor = v; settings.foregroundColor = v;
writeSettings(); writeSettings();
},
format: function (v) {return foregroundColors[v];}
}, },
}); format: function (v) {return foregroundColors[v];}
}) },
});
})