element-plus/docs/.vitepress/dark-mode.js
2022-02-21 21:36:34 +08:00

11 lines
255 B
JavaScript

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