alexohneander-zola/static/js/initializeTheme.min.js
Óscar Fernández bf31f7ff47
feat(theme-switcher)!: respect theme_default when JS is enabled (#224)
BREAKING CHANGE: changes the behaviour of `theme_default`
2023-11-25 00:08:58 +01:00

2 lines
416 B
JavaScript

!function(){var t=document.documentElement.getAttribute("data-theme"),e=(t&&document.documentElement.setAttribute("data-default-theme",t),localStorage.getItem("theme"));e?document.documentElement.setAttribute("data-theme",e):t?document.documentElement.setAttribute("data-theme",t):(e=window.matchMedia("(prefers-color-scheme: dark)").matches,document.documentElement.setAttribute("data-theme",e?"dark":"light"))}();