generated from incremental-social/The-Modding-Tree
As it turns out, you don't need to have the themes
array, you can get it from Object.keys(colors)
This commit is contained in:
parent
436505af2d
commit
225af74c76
2 changed files with 5 additions and 7 deletions
|
@ -222,7 +222,7 @@ function loadOptions() {
|
||||||
options = Object.assign(getStartOptions(), JSON.parse(decodeURIComponent(escape(atob(get2)))));
|
options = Object.assign(getStartOptions(), JSON.parse(decodeURIComponent(escape(atob(get2)))));
|
||||||
else
|
else
|
||||||
options = getStartOptions()
|
options = getStartOptions()
|
||||||
if (themes.indexOf(options.theme) < 0) theme = "default"
|
if (Object.keys(colors).indexOf(options.theme) < 0) theme = "default"
|
||||||
fixData(options, getStartOptions())
|
fixData(options, getStartOptions())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// ************ Themes ************
|
// ************ Themes ************
|
||||||
var themes = ["default", "aqua", "verdant"]
|
|
||||||
|
|
||||||
var colors = {
|
var colors = {
|
||||||
default: {
|
default: {
|
||||||
1: "#ffffff",//Branch color 1
|
1: "#ffffff",//Branch color 1
|
||||||
|
@ -47,13 +45,13 @@ function getThemeName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchTheme() {
|
function switchTheme() {
|
||||||
let index = themes.indexOf(options.theme)
|
let index = Object.keys(colors).indexOf(options.theme)
|
||||||
if (options.theme === null || index >= themes.length-1 || index < 0) {
|
if (options.theme === null || index >= Object.keys(colors).length-1 || index < 0) {
|
||||||
options.theme = themes[0];
|
options.theme = Object.keys(colors)[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
index ++;
|
index ++;
|
||||||
options.theme = themes[index];
|
options.theme = Object.keys(colors)[index];
|
||||||
}
|
}
|
||||||
changeTheme();
|
changeTheme();
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
|
|
Loading…
Reference in a new issue