Introduce dark/light mode theme switch into framework

This commit is contained in:
Hadi Nategh
2020-12-15 20:24:25 +01:00
parent 7011faba18
commit f21ac58c87
13 changed files with 143 additions and 2 deletions

View File

@ -535,6 +535,27 @@
execPushBroadcastAppStatus: function(_data)
{
if (app.status) app.status.mergeContent(_data, true);
},
/**
*
* @param node
*/
toggle_darkmode: function(node)
{
let state = node.firstElementChild.classList.contains('darkmode_on');
egw.set_preference('common', 'darkmode',state?'0':'1');
this._setDarkMode(state?'0':'1');
if (state == 1)
{
node.firstElementChild.classList.remove('darkmode_on');
node.firstElementChild.title = egw.lang('light mode');
}
else
{
node.firstElementChild.classList.add('darkmode_on');
node.firstElementChild.title = egw.lang('dark mode');
}
}
});
})(window);