background change when selecting another theme

This commit is contained in:
Samidy 2025-10-04 11:50:17 +03:00
parent 537a5f0635
commit 5b46371356

View file

@ -132,16 +132,16 @@ const updateThemeColor = (colorName: ColorNames) => {
const htmlElement = document.documentElement const htmlElement = document.documentElement
if (colorName === 'halloween') { if (colorName === 'halloween') {
htmlElement.setAttribute('data-halloween-theme', 'true') htmlElement.classList.add('theme-halloween')
} else { } else {
htmlElement.removeAttribute('data-halloween-theme') htmlElement.classList.remove('theme-halloween')
} }
} }
// Set Halloween theme ASAP if its the pref // Set Halloween theme ASAP if its the pref
const storedTheme = localStorage.getItem('preferred-color') const storedTheme = localStorage.getItem('preferred-color')
if (!storedTheme || storedTheme === '"halloween"') { if (!storedTheme || storedTheme === '"halloween"') {
document.documentElement.setAttribute('data-halloween-theme', 'true') document.documentElement.classList.add('theme-halloween')
} }
// Initialize theme color // Initialize theme color
@ -150,7 +150,7 @@ updateThemeColor(selectedColor.value)
// halloween stuff // halloween stuff
onMounted(() => { onMounted(() => {
if (selectedColor.value === 'halloween') { if (selectedColor.value === 'halloween') {
document.documentElement.setAttribute('data-halloween-theme', 'true') document.documentElement.classList.add('theme-halloween')
} }
// Re-apply the theme to ensure everything is initialized // Re-apply the theme to ensure everything is initialized
updateThemeColor(selectedColor.value) updateThemeColor(selectedColor.value)