|
|
|
@ -72,15 +72,14 @@ |
|
|
|
|
setTheme('light'); |
|
|
|
|
} |
|
|
|
|
H.set('padTheme', newTheme); |
|
|
|
|
console.log('here'); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function setTheme(newTheme){ |
|
|
|
|
|
|
|
|
|
function setTheme(newTheme) { |
|
|
|
|
document.body.classList.remove('light'); |
|
|
|
|
document.body.classList.remove('dark'); |
|
|
|
|
document.body.classList.add(newTheme); |
|
|
|
|
var btns = Array.prototype.slice.call(document.getElementById('tools').querySelectorAll('a img')); |
|
|
|
|
if (newTheme == 'light'){ |
|
|
|
|
if (newTheme == 'light') { |
|
|
|
|
// check if current theme is dark otherwise we'll get `_dark_dark@2x.png` |
|
|
|
|
if (H.get('padTheme', 'auto') == 'dark'){ |
|
|
|
|
for (var i=0; i<btns.length; i++) { |
|
|
|
@ -97,14 +96,16 @@ |
|
|
|
|
|
|
|
|
|
if (H.get('padTheme', 'auto') == 'light') { |
|
|
|
|
setTheme('light'); |
|
|
|
|
} else if (H.get('padTheme', 'auto') == 'dark'){ |
|
|
|
|
} else if (H.get('padTheme', 'auto') == 'dark') { |
|
|
|
|
setTheme('dark'); |
|
|
|
|
} else { |
|
|
|
|
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches |
|
|
|
|
if (isDarkMode) setTheme('dark'); |
|
|
|
|
else setTheme('light'); |
|
|
|
|
if (isDarkMode) { |
|
|
|
|
setTheme('dark'); |
|
|
|
|
} else { |
|
|
|
|
setTheme('light'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $writer = H.getEl('writer'); |
|
|
|
|
var $btnPublish = H.getEl('publish'); |
|
|
|
|