mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 02:08:12 +08:00
docs: persist color themes (#18102)
This commit is contained in:
parent
4246d1e468
commit
3b4acab759
@ -152,9 +152,3 @@ gtag('config', 'UA-175337989-1');`,
|
||||
`,
|
||||
],
|
||||
]
|
||||
|
||||
head.push([
|
||||
'script',
|
||||
{},
|
||||
fs.readFileSync(path.resolve(vpRoot, 'dark-mode.js'), 'utf-8'),
|
||||
])
|
||||
|
@ -1,10 +0,0 @@
|
||||
;(() => {
|
||||
const saved = localStorage.getItem('el-theme-appearance')
|
||||
if (
|
||||
saved === 'auto'
|
||||
? window.matchMedia(`(prefers-color-scheme: dark)`).matches
|
||||
: saved === 'dark'
|
||||
) {
|
||||
document.documentElement.classList.add('dark')
|
||||
}
|
||||
})()
|
@ -1,7 +1,7 @@
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
|
||||
export const isDark = useDark({
|
||||
storageKey: 'el-theme-appearance',
|
||||
storageKey: 'vitepress-theme-appearance',
|
||||
})
|
||||
|
||||
export const toggleDark = useToggle(isDark)
|
||||
|
Loading…
Reference in New Issue
Block a user