✨ feat: add support for giscus & utterances comments
This commit is contained in:
9
static/js/initializeTheme.js
Normal file
9
static/js/initializeTheme.js
Normal file
@@ -0,0 +1,9 @@
|
||||
(function () {
|
||||
const currentTheme = localStorage.getItem('theme');
|
||||
if (currentTheme) {
|
||||
document.documentElement.setAttribute('data-theme', currentTheme);
|
||||
} else {
|
||||
const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
document.documentElement.setAttribute('data-theme', isSystemDark ? 'dark' : 'light');
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user