forked from FOSS/BangleApps
settings 0.42: Fix theme customizer on new Bangle 2 firmware
parent
ef9f772a49
commit
c1db203205
|
@ -44,3 +44,4 @@
|
|||
0.39: Fix misbehaving debug info option
|
||||
0.40: Moved off into Utils, put System after Apps
|
||||
0.41: Stop users disabling all wake-up methods and locking themselves out (fix #1272)
|
||||
0.42: Fix theme customizer on new Bangle 2 firmware
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "setting",
|
||||
"name": "Settings",
|
||||
"version": "0.41",
|
||||
"version": "0.42",
|
||||
"description": "A menu for setting up Bangle.js",
|
||||
"icon": "settings.png",
|
||||
"tags": "tool,system",
|
||||
|
|
|
@ -243,12 +243,11 @@ function showThemeMenu() {
|
|||
});
|
||||
|
||||
function showCustomThemeMenu() {
|
||||
function cv(x) { return g.setColor(x).getColor(); }
|
||||
function setT(t, v) {
|
||||
let th = g.theme;
|
||||
th[t] = v;
|
||||
if (t==="bg") {
|
||||
th['dark'] = (v===cv("#000"));
|
||||
th['dark'] = (v===cl("#000"));
|
||||
}
|
||||
upd(th);
|
||||
}
|
||||
|
@ -260,11 +259,7 @@ function showThemeMenu() {
|
|||
let colors = [], names = [];
|
||||
for(const c in rgb) {
|
||||
names.push(c);
|
||||
colors.push(cv(rgb[c]));
|
||||
}
|
||||
function cn(v) {
|
||||
const i = colors.indexOf(v);
|
||||
return i!== -1 ? names[i] : v; // another color: just show value
|
||||
colors.push(cl(rgb[c]));
|
||||
}
|
||||
let menu = {
|
||||
'':{title:'Custom Theme'},
|
||||
|
@ -277,14 +272,11 @@ function showThemeMenu() {
|
|||
};
|
||||
["fg", "bg", "fg2", "bg2", "fgH", "bgH"].forEach(t => {
|
||||
menu[labels[t]] = {
|
||||
value: colors.indexOf(g.theme[t]),
|
||||
format: () => cn(g.theme[t]),
|
||||
min : 0, max : colors.length-1, wrap : true,
|
||||
value: Math.max(colors.indexOf(g.theme[t]),0),
|
||||
format: v => names[v],
|
||||
onchange: function(v) {
|
||||
// wrap around
|
||||
if (v>=colors.length) {v = 0;}
|
||||
if (v<0) {v = colors.length-1;}
|
||||
this.value = v;
|
||||
const c = colors[v];
|
||||
var c = colors[v];
|
||||
// if we select the same fg and bg: set the other to the old color
|
||||
// e.g. bg=black;fg=white, user selects fg=black -> bg changes to white automatically
|
||||
// so users don't end up with a black-on-black menu
|
||||
|
|
Loading…
Reference in New Issue