mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
fix: themes somtimes override default custom accent colour
This commit is contained in:
@@ -96,11 +96,6 @@
|
||||
onDestroy(() => {
|
||||
themeUpdates.removeListener(fetchThemes);
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
if (!themes) return;
|
||||
console.log(themes.selectedTheme);
|
||||
})
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
||||
@@ -15,9 +15,11 @@ const themeManager = ThemeManager.getInstance();
|
||||
export function OpenThemeCreator(themeID: string = "") {
|
||||
CloseThemeCreator()
|
||||
|
||||
// Store that theme creator is open and save original color
|
||||
// Only store original color if we're not editing an existing theme
|
||||
localStorage.setItem('themeCreatorOpen', 'true');
|
||||
if (!themeID) {
|
||||
localStorage.setItem('originalPreviewColor', settingsState.selectedColor);
|
||||
}
|
||||
|
||||
const width = "310px"
|
||||
|
||||
|
||||
@@ -454,7 +454,8 @@ export class ThemeManager {
|
||||
try {
|
||||
const { CustomCSS, CustomImages, defaultColour, forceDark } = theme;
|
||||
|
||||
// Store original settings if not already stored
|
||||
// Store original settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
if (this.originalPreviewColor === null) {
|
||||
this.originalPreviewColor = settingsState.selectedColor;
|
||||
localStorage.setItem('originalPreviewColor', settingsState.selectedColor);
|
||||
@@ -462,6 +463,7 @@ export class ThemeManager {
|
||||
if (this.originalPreviewTheme === null) {
|
||||
this.originalPreviewTheme = settingsState.DarkMode;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply custom CSS
|
||||
if (CustomCSS) {
|
||||
@@ -487,13 +489,15 @@ export class ThemeManager {
|
||||
// Update previousImageVariableNames
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
|
||||
// Apply theme settings
|
||||
// Apply theme settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
if (forceDark !== undefined) {
|
||||
settingsState.DarkMode = forceDark;
|
||||
}
|
||||
if (defaultColour) {
|
||||
settingsState.selectedColor = defaultColour;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[ThemeManager] Error previewing theme:', error);
|
||||
}
|
||||
@@ -505,13 +509,16 @@ export class ThemeManager {
|
||||
public async updatePreview(theme: Partial<LoadedCustomTheme>): Promise<void> {
|
||||
console.debug('[ThemeManager] Updating theme preview');
|
||||
try {
|
||||
// Store original settings if not already stored
|
||||
// Only store original settings if this is a new theme (not editing)
|
||||
// We can tell it's a new theme if it has no webURL (which is set when a theme is saved/loaded)
|
||||
if (!theme.webURL) {
|
||||
if (this.originalPreviewColor === null) {
|
||||
this.originalPreviewColor = settingsState.selectedColor;
|
||||
}
|
||||
if (this.originalPreviewTheme === null) {
|
||||
this.originalPreviewTheme = settingsState.DarkMode;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply CSS if changed
|
||||
if (theme.CustomCSS !== undefined) {
|
||||
@@ -548,13 +555,15 @@ export class ThemeManager {
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
}
|
||||
|
||||
// Update theme settings
|
||||
// Update theme settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
if (theme.forceDark !== undefined) {
|
||||
settingsState.DarkMode = theme.forceDark;
|
||||
}
|
||||
if (theme.defaultColour) {
|
||||
settingsState.selectedColor = theme.defaultColour;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[ThemeManager] Error updating theme preview:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user