mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
quick fix to forced mode as well
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import localforage from "localforage";
|
||||
import browser from "webextension-polyfill";
|
||||
import type { CustomTheme, LoadedCustomTheme } from "@/types/CustomThemes";
|
||||
import {
|
||||
type CustomTheme,
|
||||
type LoadedCustomTheme,
|
||||
getForcedDarkMode,
|
||||
shouldForceThemeAppearance,
|
||||
} from "@/types/CustomThemes";
|
||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||
import debounce from "@/seqta/utils/debounce";
|
||||
import { updateAllColors } from "@/seqta/ui/colors/Manager";
|
||||
@@ -19,6 +24,7 @@ type ThemeContent = {
|
||||
CustomCSS?: string;
|
||||
hideThemeName?: boolean;
|
||||
forceDark?: boolean;
|
||||
forceTheme?: boolean;
|
||||
adaptiveCssVariables?: string[];
|
||||
images: { id: string; variableName: string; data: string }[]; // data: base64
|
||||
};
|
||||
@@ -215,7 +221,7 @@ export class ThemeManager {
|
||||
console.debug("[ThemeManager] Storing original settings");
|
||||
settingsState.originalSelectedColor = settingsState.selectedColor;
|
||||
|
||||
if (theme.forceDark) {
|
||||
if (shouldForceThemeAppearance(theme)) {
|
||||
settingsState.originalDarkMode = settingsState.DarkMode;
|
||||
}
|
||||
}
|
||||
@@ -277,9 +283,10 @@ export class ThemeManager {
|
||||
}
|
||||
|
||||
// Apply theme settings
|
||||
if (theme.forceDark !== undefined) {
|
||||
console.debug("[ThemeManager] Setting dark mode:", theme.forceDark);
|
||||
settingsState.DarkMode = theme.forceDark;
|
||||
if (shouldForceThemeAppearance(theme)) {
|
||||
const dark = getForcedDarkMode(theme);
|
||||
console.debug("[ThemeManager] Setting dark mode:", dark);
|
||||
settingsState.DarkMode = dark;
|
||||
}
|
||||
|
||||
// Use the stored selected color if available, otherwise use the default
|
||||
@@ -595,6 +602,12 @@ export class ThemeManager {
|
||||
isEditable: false,
|
||||
hideThemeName: themeData.hideThemeName ?? false,
|
||||
forceDark: themeData.forceDark,
|
||||
forceTheme:
|
||||
themeData.forceTheme !== undefined
|
||||
? themeData.forceTheme
|
||||
: themeData.forceDark !== undefined
|
||||
? true
|
||||
: undefined,
|
||||
adaptiveCssVariables: themeData.adaptiveCssVariables,
|
||||
};
|
||||
|
||||
@@ -662,7 +675,7 @@ export class ThemeManager {
|
||||
public async previewTheme(theme: LoadedCustomTheme): Promise<void> {
|
||||
console.debug("[ThemeManager] Previewing theme:", theme.name);
|
||||
try {
|
||||
const { CustomCSS, CustomImages, defaultColour, forceDark } = theme;
|
||||
const { CustomCSS, CustomImages, defaultColour } = theme;
|
||||
|
||||
// Store original settings only if this is a new theme
|
||||
if (!theme.webURL) {
|
||||
@@ -708,8 +721,8 @@ export class ThemeManager {
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
|
||||
// Apply theme settings
|
||||
if (forceDark !== undefined) {
|
||||
settingsState.DarkMode = forceDark;
|
||||
if (shouldForceThemeAppearance(theme)) {
|
||||
settingsState.DarkMode = getForcedDarkMode(theme);
|
||||
}
|
||||
|
||||
if (defaultColour) {
|
||||
@@ -783,9 +796,9 @@ export class ThemeManager {
|
||||
this.previousImageVariableNames = newImageVariableNames;
|
||||
}
|
||||
|
||||
// Always apply dark mode setting
|
||||
if (theme.forceDark !== undefined) {
|
||||
settingsState.DarkMode = theme.forceDark;
|
||||
// Always apply dark mode setting when theme forces appearance
|
||||
if (shouldForceThemeAppearance(theme as CustomTheme)) {
|
||||
settingsState.DarkMode = getForcedDarkMode(theme as CustomTheme);
|
||||
}
|
||||
|
||||
// Only apply color if this is a new theme
|
||||
|
||||
Reference in New Issue
Block a user