mirror of
https://github.com/zombieFox/nightTab.git
synced 2024-11-25 01:23:15 +01:00
46 lines
830 B
JavaScript
46 lines
830 B
JavaScript
var theme = (function() {
|
|
|
|
var toggle = function() {
|
|
var style = {
|
|
dark: function() {
|
|
helper.setObject({
|
|
object: state.get(),
|
|
path: "theme.style",
|
|
newValue: "light"
|
|
})
|
|
},
|
|
light: function() {
|
|
helper.setObject({
|
|
object: state.get(),
|
|
path: "theme.style",
|
|
newValue: "dark"
|
|
})
|
|
}
|
|
};
|
|
style[state.get().theme.style]();
|
|
};
|
|
|
|
var render = {
|
|
radius: function() {
|
|
_renderRadius();
|
|
}
|
|
};
|
|
|
|
var _renderRadius = function() {
|
|
var html = helper.e("html");
|
|
html.style.setProperty("--theme-radius", state.get().theme.radius + "rem");
|
|
};
|
|
|
|
var init = function() {
|
|
render.radius();
|
|
};
|
|
|
|
// exposed methods
|
|
return {
|
|
render: render,
|
|
toggle: toggle,
|
|
init: init
|
|
};
|
|
|
|
})();
|