fix(theme): improve force-dark in development (#450)

This commit is contained in:
pengzhanbo 2025-01-28 00:26:36 +08:00 committed by GitHub
parent c703b89e1c
commit 149d31818f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,6 +43,10 @@ export function setupDarkMode(app: App): void {
app.provide(darkModeSymbol, isDark)
if (__VUEPRESS_DEV__ && appearance === 'force-dark' && typeof document !== 'undefined') {
document.documentElement.dataset.theme = 'dark'
}
Object.defineProperty(app.config.globalProperties, '$isDark', {
get: () => isDark,
})