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

@ -15,7 +15,7 @@ export default defineNuxtPlugin(() => {
const settings = allSettings[handle]
if (!settings) { return }
const html = document.querySelector('html')
const html = document.documentElement
${process.dev ? 'console.log({ settings })' : ''}
if (settings.fontSize) {
@ -28,6 +28,9 @@ export default defineNuxtPlugin(() => {
if (settings.zenMode) {
html.classList.add('zen')
}
if (settings.themeColors) {
Object.entries(settings.themeColors).map(i => html.style.setProperty(i[0], i[1]))
}
})()`.trim().replace(/\s*\n+\s*/g, ';'),
},
],