feat: add force theme option to custom themes

This commit is contained in:
sethburkart123
2024-08-20 12:57:07 +10:00
parent a2dac4d84d
commit 4a9048ac62
5 changed files with 37 additions and 1 deletions
+5
View File
@@ -1,4 +1,5 @@
import { CustomImage, CustomTheme } from '../../../interface/types/CustomThemes';
import { settingsState } from '../../utils/listeners/SettingsState';
import { applyCustomCSS } from './Themes';
@@ -8,6 +9,10 @@ export const applyTheme = async (theme: CustomTheme) => {
if (theme?.CustomCSS) CustomCSS = theme.CustomCSS;
if (theme?.CustomImages) CustomImages = theme.CustomImages;
if (theme?.forceDark) {
settingsState.originalDarkMode = settingsState.DarkMode
settingsState.DarkMode = theme.forceDark
}
// Apply custom CSS
applyCustomCSS(CustomCSS);
+5
View File
@@ -19,6 +19,11 @@ export const removeTheme = async (theme: CustomTheme) => {
if (settingsState.originalSelectedColor !== '') {
settingsState.selectedColor = settingsState.originalSelectedColor
}
if (settingsState.originalDarkMode !== undefined) {
settingsState.DarkMode = settingsState.originalDarkMode
settingsState.originalDarkMode = undefined
}
// Remove custom images
const customImageVariables = theme.CustomImages.map((image) => image.variableName);