mirror of https://github.com/espruino/BangleApps
Update settings.js
parent
134ef22606
commit
52c8df698b
|
@ -16,6 +16,12 @@
|
||||||
require('Storage').writeJSON(LOC, appSettings);
|
require('Storage').writeJSON(LOC, appSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sync theme with current Bangle.js theme
|
||||||
|
function syncTheme() {
|
||||||
|
let sysSettings = require('Storage').readJSON(SYS, 1) || {};
|
||||||
|
appSettings.theme = sysSettings.theme && sysSettings.theme.dark ? 'dark' : 'light';
|
||||||
|
}
|
||||||
|
|
||||||
// Switch theme and save to storage
|
// Switch theme and save to storage
|
||||||
function switchTheme(mode) {
|
function switchTheme(mode) {
|
||||||
if (mode === g.theme.dark) return;
|
if (mode === g.theme.dark) return;
|
||||||
|
@ -30,9 +36,12 @@
|
||||||
if (Bangle.CLOCK) load(global.__FILE__);
|
if (Bangle.CLOCK) load(global.__FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sync theme before showing settings menu
|
||||||
|
syncTheme();
|
||||||
|
|
||||||
// Show settings menu
|
// Show settings menu
|
||||||
E.showMenu({
|
E.showMenu({
|
||||||
"": { "title": "Shadow Clock" },
|
"": {"title": "Shadow Clock"},
|
||||||
"< Back": () => back(),
|
"< Back": () => back(),
|
||||||
'Theme:': {
|
'Theme:': {
|
||||||
value: (appSettings.theme === 'dark'),
|
value: (appSettings.theme === 'dark'),
|
||||||
|
|
Loading…
Reference in New Issue