1
0
mirror of https://github.com/elk-zone/elk synced 2024-11-23 22:56:09 +09:00
elk/plugins/setup-global-effects.client.ts
renovate[bot] 320ddc0e28
chore(deps): update dependency @antfu/eslint-config to v3 (#2984)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
2024-09-30 08:11:56 +00:00

19 lines
724 B
TypeScript

import type { OldFontSize } from '~/composables/settings'
import { DEFAULT_FONT_SIZE } from '~/constants'
import { oldFontSizeMap } from '~/constants/options'
export default defineNuxtPlugin(() => {
const userSettings = useUserSettings()
const html = document.documentElement
watchEffect(() => {
const { fontSize } = userSettings.value
html.style.setProperty('--font-size', fontSize ? (oldFontSizeMap[fontSize as OldFontSize] ?? fontSize) : DEFAULT_FONT_SIZE)
})
watchEffect(() => {
html.classList.toggle('zen', getPreferences(userSettings.value, 'zenMode'))
})
watchEffect(() => {
Object.entries(userSettings.value.themeColors || {}).forEach(([k, v]) => html.style.setProperty(k, v))
})
})