💄 Improve the theme switch logic with config defined.
This commit is contained in:
parent
a7b9d5338e
commit
d6fbf924b8
@ -36,9 +36,10 @@ NexT.utils = {
|
|||||||
activeThemeMode: function() {
|
activeThemeMode: function() {
|
||||||
|
|
||||||
const useDark = window.matchMedia("(prefers-color-scheme: dark)");
|
const useDark = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
let darkModeState = useDark.matches;
|
let darkModeState = NexT.CONFIG.darkmode || useDark.matches;
|
||||||
const localState = NexT.utils.getLocalStorage('theme');
|
const localState = NexT.utils.getLocalStorage('theme');
|
||||||
if (localState == 'light') {
|
if (localState == 'light'
|
||||||
|
|| (localState == undefined && !NexT.CONFIG.darkmode)) {
|
||||||
darkModeState = false;
|
darkModeState = false;
|
||||||
}
|
}
|
||||||
NexT.utils.toggleDarkMode(darkModeState);
|
NexT.utils.toggleDarkMode(darkModeState);
|
||||||
|
Loading…
Reference in New Issue
Block a user