mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
fix: themes custom colour not being completely applied
This commit is contained in:
@@ -75,10 +75,8 @@
|
||||
}))
|
||||
}
|
||||
|
||||
if (tempTheme) {
|
||||
theme = loadedTheme
|
||||
themeLoaded = true
|
||||
}
|
||||
} else {
|
||||
themeLoaded = true
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ export class ThemeManager {
|
||||
// Remove current theme if exists
|
||||
if (this.currentTheme) {
|
||||
console.debug('[ThemeManager] Removing current theme');
|
||||
|
||||
await this.removeTheme(this.currentTheme);
|
||||
}
|
||||
|
||||
@@ -185,8 +186,12 @@ export class ThemeManager {
|
||||
settingsState.DarkMode = theme.forceDark;
|
||||
}
|
||||
|
||||
if (theme.defaultColour) {
|
||||
console.debug('[ThemeManager] Setting color:', theme.defaultColour);
|
||||
// Use the stored selected color if available, otherwise use the default
|
||||
if (theme.selectedColor) {
|
||||
console.debug('[ThemeManager] Restoring saved color:', theme.selectedColor);
|
||||
settingsState.selectedColor = theme.selectedColor;
|
||||
} else if (theme.defaultColour) {
|
||||
console.debug('[ThemeManager] Using default color:', theme.defaultColour);
|
||||
settingsState.selectedColor = theme.defaultColour;
|
||||
}
|
||||
|
||||
@@ -220,6 +225,14 @@ export class ThemeManager {
|
||||
});
|
||||
}
|
||||
|
||||
if (this.currentTheme) {
|
||||
// Store the current color with the theme before removing it
|
||||
await localforage.setItem(this.currentTheme.id, {
|
||||
...this.currentTheme,
|
||||
selectedColor: settingsState.selectedColor
|
||||
});
|
||||
}
|
||||
|
||||
// Restore original settings
|
||||
if (settingsState.originalSelectedColor) {
|
||||
console.debug('[ThemeManager] Restoring original color:', settingsState.originalSelectedColor);
|
||||
@@ -489,15 +502,14 @@ export class ThemeManager {
|
||||
// Update previousImageVariableNames
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
|
||||
// Apply theme settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
// Apply theme settings
|
||||
if (forceDark !== undefined) {
|
||||
settingsState.DarkMode = forceDark;
|
||||
}
|
||||
|
||||
if (defaultColour) {
|
||||
settingsState.selectedColor = defaultColour;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[ThemeManager] Error previewing theme:', error);
|
||||
}
|
||||
@@ -555,15 +567,15 @@ export class ThemeManager {
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
}
|
||||
|
||||
// Update theme settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
// Always apply dark mode setting
|
||||
if (theme.forceDark !== undefined) {
|
||||
settingsState.DarkMode = theme.forceDark;
|
||||
}
|
||||
if (theme.defaultColour) {
|
||||
|
||||
// Only apply color if this is a new theme
|
||||
if (!theme.webURL && theme.defaultColour) {
|
||||
settingsState.selectedColor = theme.defaultColour;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[ThemeManager] Error updating theme preview:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user