mirror of
https://github.com/fmhy/edit.git
synced 2025-10-12 15:51:07 +11:00
background change when selecting another theme
This commit is contained in:
parent
537a5f0635
commit
5b46371356
1 changed files with 4 additions and 4 deletions
|
@ -132,16 +132,16 @@ const updateThemeColor = (colorName: ColorNames) => {
|
|||
|
||||
const htmlElement = document.documentElement
|
||||
if (colorName === 'halloween') {
|
||||
htmlElement.setAttribute('data-halloween-theme', 'true')
|
||||
htmlElement.classList.add('theme-halloween')
|
||||
} else {
|
||||
htmlElement.removeAttribute('data-halloween-theme')
|
||||
htmlElement.classList.remove('theme-halloween')
|
||||
}
|
||||
}
|
||||
|
||||
// Set Halloween theme ASAP if its the pref
|
||||
const storedTheme = localStorage.getItem('preferred-color')
|
||||
if (!storedTheme || storedTheme === '"halloween"') {
|
||||
document.documentElement.setAttribute('data-halloween-theme', 'true')
|
||||
document.documentElement.classList.add('theme-halloween')
|
||||
}
|
||||
|
||||
// Initialize theme color
|
||||
|
@ -150,7 +150,7 @@ updateThemeColor(selectedColor.value)
|
|||
// halloween stuff
|
||||
onMounted(() => {
|
||||
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
|
||||
updateThemeColor(selectedColor.value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue