feat: theme colors (#1195)

This commit is contained in:
Anthony Fu 2023-01-16 11:26:19 +01:00 committed by GitHub
parent 2e79f3aa37
commit 8753a94aae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 298 additions and 35 deletions

View file

@ -3,11 +3,14 @@ import { DEFAULT_FONT_SIZE } from '~/constants'
export default defineNuxtPlugin(() => {
const userSettings = useUserSettings()
const html = document.querySelector('html')!
const html = document.documentElement
watchEffect(() => {
html.style.setProperty('--font-size', fontSizeMap[userSettings.value.fontSize || DEFAULT_FONT_SIZE])
})
watchEffect(() => {
html.classList.toggle('zen', userSettings.value.zenMode)
})
watchEffect(() => {
Object.entries(userSettings.value.themeColors || {}).forEach(([k, v]) => html.style.setProperty(k, v))
})
})