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