element-plus/docs/.vitepress/dark-mode.js
三咲智子 a5dd21e94a
docs(build): refactor config & support dev without pre build (#3743)
* docs: refactor config

* docs(build): support dev without pre build

* docs: disable sourcemap
2021-09-30 19:26:30 +08:00

11 lines
251 B
JavaScript

;(() => {
const saved = localStorage.getItem('preferred_theme')
if (
saved === 'auto'
? window.matchMedia(`(prefers-color-scheme: dark)`).matches
: saved === 'dark'
) {
document.documentElement.classList.add('dark')
}
})()