2023-01-14 12:34:53 +03:00
|
|
|
import { fontSizeMap } from '~/constants/options'
|
|
|
|
import { DEFAULT_FONT_SIZE } from '~/constants'
|
|
|
|
|
|
|
|
export default defineNuxtPlugin(() => {
|
|
|
|
const userSettings = useUserSettings()
|
2023-01-16 13:26:19 +03:00
|
|
|
const html = document.documentElement
|
2023-01-14 12:34:53 +03:00
|
|
|
watchEffect(() => {
|
|
|
|
html.style.setProperty('--font-size', fontSizeMap[userSettings.value.fontSize || DEFAULT_FONT_SIZE])
|
|
|
|
})
|
2023-01-14 13:09:17 +03:00
|
|
|
watchEffect(() => {
|
|
|
|
html.classList.toggle('zen', userSettings.value.zenMode)
|
|
|
|
})
|
2023-01-16 13:26:19 +03:00
|
|
|
watchEffect(() => {
|
|
|
|
Object.entries(userSettings.value.themeColors || {}).forEach(([k, v]) => html.style.setProperty(k, v))
|
|
|
|
})
|
2023-01-14 12:34:53 +03:00
|
|
|
})
|