mirror of
https://github.com/fmhy/edit.git
synced 2026-01-12 15:01:06 +11:00
fix(themeHandler): properly keep track of color theme when using preset (#4459)
This commit is contained in:
parent
574741cb5c
commit
89ec4df6a5
2 changed files with 3 additions and 7 deletions
|
|
@ -202,6 +202,7 @@ onMounted(async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(selectedColor, async (color) => {
|
watch(selectedColor, async (color) => {
|
||||||
|
if (!color) return;
|
||||||
const theme = generateThemeFromColor(color)
|
const theme = generateThemeFromColor(color)
|
||||||
themeRegistry[`color-${color}`] = theme
|
themeRegistry[`color-${color}`] = theme
|
||||||
// Explicitly set the theme to override any previous selection
|
// Explicitly set the theme to override any previous selection
|
||||||
|
|
@ -225,7 +226,7 @@ const toggleAmoled = () => {
|
||||||
<button
|
<button
|
||||||
:class="[
|
:class="[
|
||||||
'inline-block w-6 h-6 rounded-full transition-all duration-200 border-2',
|
'inline-block w-6 h-6 rounded-full transition-all duration-200 border-2',
|
||||||
selectedColor === color
|
(themeName && themeName.value === `color-${color}`)
|
||||||
? 'border-slate-200 dark:border-slate-400 shadow-lg'
|
? 'border-slate-200 dark:border-slate-400 shadow-lg'
|
||||||
: 'border-transparent'
|
: 'border-transparent'
|
||||||
]"
|
]"
|
||||||
|
|
@ -248,7 +249,7 @@ const toggleAmoled = () => {
|
||||||
? 'border-slate-200 dark:border-slate-400 shadow-lg'
|
? 'border-slate-200 dark:border-slate-400 shadow-lg'
|
||||||
: 'border-transparent'
|
: 'border-transparent'
|
||||||
]"
|
]"
|
||||||
@click="setTheme(t)"
|
@click="selectedColor = '' as ColorNames; setTheme(t)"
|
||||||
:title="themeRegistry[t].displayName"
|
:title="themeRegistry[t].displayName"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,6 @@ export class ThemeHandler {
|
||||||
if (mode === 'dark' && this.amoledEnabled.value) {
|
if (mode === 'dark' && this.amoledEnabled.value) {
|
||||||
root.classList.add('amoled')
|
root.classList.add('amoled')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add dark class for backward compatibility with VitePress
|
|
||||||
if (mode === 'dark') {
|
|
||||||
root.classList.add('dark')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyCSSVariables(colors: ModeColors, theme: Theme) {
|
private applyCSSVariables(colors: ModeColors, theme: Theme) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue