2018-12-26 08:45:53 +01:00
|
|
|
var theme = (function() {
|
|
|
|
|
2019-04-01 17:11:39 +02:00
|
|
|
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"
|
|
|
|
})
|
|
|
|
}
|
2019-01-07 15:42:14 +01:00
|
|
|
};
|
2019-04-01 17:11:39 +02:00
|
|
|
style[state.get().theme.style]();
|
2018-12-26 08:45:53 +01:00
|
|
|
};
|
|
|
|
|
2019-06-11 11:54:10 +02:00
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2018-12-26 08:45:53 +01:00
|
|
|
// exposed methods
|
|
|
|
return {
|
2019-06-11 11:54:10 +02:00
|
|
|
render: render,
|
|
|
|
toggle: toggle,
|
|
|
|
init: init
|
2018-12-26 08:45:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
})();
|