[refactor] improve theme preset get

This commit is contained in:
zombieFox 2019-12-29 17:20:06 -07:00
parent f0cfe94003
commit 484ea71acc

View File

@ -109,37 +109,36 @@ var theme = (function() {
mod.preset = { mod.preset = {
set: function(name) { set: function(name) {
var selectedPreset = mod.preset.get(name);
helper.setObject({ helper.setObject({
object: state.get.current(), object: state.get.current(),
path: "theme.style", path: "theme.style",
newValue: mod.preset.all[name].style newValue: selectedPreset.style
}); });
helper.setObject({ helper.setObject({
object: state.get.current(), object: state.get.current(),
path: "theme.font.display", path: "theme.font",
newValue: mod.preset.all[name].font.display newValue: selectedPreset.font
});
helper.setObject({
object: state.get.current(),
path: "theme.font.ui",
newValue: mod.preset.all[name].font.ui
}); });
helper.setObject({ helper.setObject({
object: state.get.current(), object: state.get.current(),
path: "theme.color", path: "theme.color",
newValue: mod.preset.all[name].color newValue: selectedPreset.color
}); });
helper.setObject({ helper.setObject({
object: state.get.current(), object: state.get.current(),
path: "theme.accent.current", path: "theme.accent.current",
newValue: mod.preset.all[name].accent newValue: selectedPreset.accent
}); });
helper.setObject({ helper.setObject({
object: state.get.current(), object: state.get.current(),
path: "theme.radius", path: "theme.radius",
newValue: mod.preset.all[name].radius newValue: selectedPreset.radius
}); });
}, },
get: function(name) {
return JSON.parse(JSON.stringify(mod.preset.all[name]));
},
all: { all: {
nighttab: { nighttab: {
font: { font: {