mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-06-26 04:21:38 +02:00
[refactor] improve theme preset get
This commit is contained in:
parent
f0cfe94003
commit
484ea71acc
@ -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: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user