Update settings.js
parent
d6184765c1
commit
bfeaa5219f
|
|
@ -1,18 +1,16 @@
|
||||||
(function (back) {
|
(function (back) {
|
||||||
const LOC = "shadowclk.json";
|
let teletextColors = ["#000", "#f00", "#0f0", "#ff0", "#00f", "#f0f", "#0ff", "#fff"];
|
||||||
const SYS = "setting.json";
|
let teletextColorNames = ["Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White"];
|
||||||
const teletextColors = ["#000", "#f00", "#0f0", "#ff0", "#00f", "#f0f", "#0ff", "#fff"];
|
|
||||||
const teletextColorNames = ["Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White"];
|
|
||||||
|
|
||||||
// Load and set default settings
|
// Load and set default settings
|
||||||
let appSettings = Object.assign({
|
let appSettings = Object.assign({
|
||||||
color: teletextColors[6],
|
color: teletextColors[6],
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
}, require('Storage').readJSON(LOC, true) || {});
|
}, require('Storage').readJSON(shadowclk.json, true) || {});
|
||||||
|
|
||||||
// Save settings to storage
|
// Save settings to storage
|
||||||
function writeSettings() {
|
function writeSettings() {
|
||||||
require('Storage').writeJSON(LOC, appSettings);
|
require('Storage').writeJSON(shadowclk.json, appSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colors from 'Light BW' and 'Dark BW' themes
|
// Colors from 'Light BW' and 'Dark BW' themes
|
||||||
|
|
@ -28,9 +26,9 @@
|
||||||
// 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;
|
||||||
let s = require("Storage").readJSON(SYS, 1) || {};
|
let s = require("Storage").readJSON(setting.json, 1) || {};
|
||||||
s.theme = createThemeColors(mode);
|
s.theme = createThemeColors(mode);
|
||||||
require("Storage").writeJSON(SYS, s);
|
require("Storage").writeJSON(setting.json, s);
|
||||||
updateTheme(mode);
|
updateTheme(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +49,7 @@
|
||||||
|
|
||||||
// Read the current system theme
|
// Read the current system theme
|
||||||
function getCurrentTheme() {
|
function getCurrentTheme() {
|
||||||
let s = require("Storage").readJSON(SYS, 1) || {};
|
let s = require("Storage").readJSON(setting.json, 1) || {};
|
||||||
return s.theme.dark ? 'dark' : 'light';
|
return s.theme.dark ? 'dark' : 'light';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue