Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: correcting the color customization via extconfigs

Ilian Sapundshiev25877ff650c7
diff --git a/src/renderer/components/dialogs/OnboardingDialog.tsx b/src/renderer/components/dialogs/OnboardingDialog.tsx
index 9831454c0..77cb210ee 100644
--- a/src/renderer/components/dialogs/OnboardingDialog.tsx
+++ b/src/renderer/components/dialogs/OnboardingDialog.tsx
@@ -39,7 +39,7 @@ import {
import i18n from '-/services/i18n';
import { getDevicePaths, setLanguage } from '-/services/utils-io';
import { CommonLocation } from '-/utils/CommonLocation';
-import { darkThemes, lightThemes } from '-/utils/Themes';
+import { getDarkThemes, getLightThemes } from '-/utils/Themes';
import CheckIcon from '@mui/icons-material/Check';
import FolderIcon from '@mui/icons-material/Folder';
import Box from '@mui/material/Box';
@@ -652,7 +652,7 @@ function OnboardingDialog(props: Props) {
marginBottom: '20px',
}}
>
- {Object.entries(lightThemes).map(([key, value]) => (
+ {Object.entries(getLightThemes()).map(([key, value]) => (
<ThemeTile
key={key}
themeKey={key}
@@ -678,7 +678,7 @@ function OnboardingDialog(props: Props) {
gap: 1,
}}
>
- {Object.entries(darkThemes).map(([key, value]) => (
+ {Object.entries(getDarkThemes()).map(([key, value]) => (
<ThemeTile
key={key}
themeKey={key}
diff --git a/src/renderer/components/dialogs/components/SettingsGeneral.tsx b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
index 6ddb93e27..e316a8bd6 100644
--- a/src/renderer/components/dialogs/components/SettingsGeneral.tsx
+++ b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
@@ -73,7 +73,7 @@ import CredentialsPasswordSetupDialog from '-/components/dialogs/CredentialsPass
import { isWorkerAvailable, setLanguage } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import { clearAllURLParams } from '-/utils/dom';
-import { darkThemes, lightThemes } from '-/utils/Themes';
+import { getDarkThemes, getLightThemes } from '-/utils/Themes';
import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord';
import { Box, IconButton, InputAdornment, ListItemIcon } from '@mui/material';
import CircularProgress from '@mui/material/CircularProgress';
@@ -537,7 +537,7 @@ function SettingsGeneral() {
)
}
>
- {Object.entries(lightThemes).map((theme) => {
+ {Object.entries(getLightThemes()).map((theme) => {
const themeKey = theme[0];
const themeValue = theme[1];
const themeName =
@@ -596,7 +596,7 @@ function SettingsGeneral() {
)
}
>
- {Object.entries(darkThemes).map((theme) => {
+ {Object.entries(getDarkThemes()).map((theme) => {
const themeKey = theme[0];
const themeValue = theme[1];
const themeName =
diff --git a/src/renderer/reducers/index.ts b/src/renderer/reducers/index.ts
index e836851c3..28e776de1 100644
--- a/src/renderer/reducers/index.ts
+++ b/src/renderer/reducers/index.ts
@@ -100,13 +100,13 @@ function configureApp(extConfigObj) {
Object.freeze(AppConfig.ExtEnabledPerspectives);
}
AppConfig.ExtLightThemeLightColor =
- extConfigObj.ExtLightThemeLightColor ?? AppConfig.ExtLightThemeLightColor; // do not apply currently
+ extConfigObj.ExtLightThemeLightColor ?? AppConfig.ExtLightThemeLightColor;
AppConfig.ExtLightThemeMainColor =
- extConfigObj.ExtLightThemeMainColor ?? AppConfig.ExtLightThemeMainColor; // do not apply currently
+ extConfigObj.ExtLightThemeMainColor ?? AppConfig.ExtLightThemeMainColor;
AppConfig.ExtDarkThemeLightColor =
- extConfigObj.ExtDarkThemeLightColor ?? AppConfig.ExtDarkThemeLightColor; // do not apply currently
+ extConfigObj.ExtDarkThemeLightColor ?? AppConfig.ExtDarkThemeLightColor;
AppConfig.ExtDarkThemeMainColor =
- extConfigObj.ExtDarkThemeMainColor ?? AppConfig.ExtDarkThemeMainColor; // do not apply currently
+ extConfigObj.ExtDarkThemeMainColor ?? AppConfig.ExtDarkThemeMainColor;
AppConfig.ExtDefaultSystemPrompt =
extConfigObj.ExtDefaultSystemPrompt ?? AppConfig.ExtDefaultSystemPrompt;
AppConfig.ExtDefaultQuestionPrompt =
diff --git a/src/renderer/utils/Themes.ts b/src/renderer/utils/Themes.ts
index fa43771aa..051e888c9 100644
--- a/src/renderer/utils/Themes.ts
+++ b/src/renderer/utils/Themes.ts
@@ -20,7 +20,9 @@ import AppConfig from '-/AppConfig';
import { createTheme } from '@mui/material';
export const createTSTheme = (themeName: string, isDark: boolean = false) => {
- let palette = isDark ? darkThemes[themeName] : lightThemes[themeName];
+ let palette = isDark
+ ? getDarkThemes()[themeName]
+ : getLightThemes()[themeName];
if (!palette) {
const primaryLightColor = isDark
? AppConfig.ExtDarkThemeLightColor
@@ -57,143 +59,149 @@ export const createTSTheme = (themeName: string, isDark: boolean = false) => {
});
};
-export const darkThemes = {};
-darkThemes['darklegacy'] = {
- mode: 'dark',
- primary: {
- light: AppConfig.ExtDarkThemeLightColor,
- main: AppConfig.ExtDarkThemeMainColor, // #ff9abe
- dark: AppConfig.ExtDarkThemeMainColor,
- },
- secondary: { main: '#006541' },
- background: { default: '#282A36' },
- divider: '#555',
-};
-darkThemes['dracula'] = {
- mode: 'dark',
- primary: {
- light: '#503d50',
- main: '#BD93F9',
- dark: '#BD93F9',
- },
- secondary: { main: '#426c06' },
- divider: '#555',
- background: { default: '#282A36' },
- text: { primary: '#f8f8f2' },
-};
-darkThemes['darkblue'] = {
- mode: 'dark',
- primary: {
- light: '#a6def4',
- main: '#3bc8ff',
- dark: '#3bc8ff',
- },
- secondary: { main: '#c43700' },
- background: { default: '#001E3C' },
- text: { primary: '#f8f8f2' },
- divider: '#555',
-};
-darkThemes['oilgreen'] = {
- mode: 'dark',
- primary: {
- light: '#138086',
- main: '#138086',
- dark: '#04484cff',
- },
- secondary: { main: '#ec7f79' },
- background: { default: '#000' },
- text: { primary: '#f8f8f2' },
- divider: '#555',
-};
-darkThemes['orangegreen'] = {
- mode: 'dark',
- primary: {
- light: '#f3b759',
- main: '#f3b759',
- dark: '#fd8f52',
- },
- secondary: { main: '#0c48a6' },
- background: { default: '#0d4a3a' },
- text: { primary: '#f8f8f2' },
- divider: '#555',
-};
-darkThemes['limecoal'] = {
- mode: 'dark',
- primary: {
- light: '#a8b735ff', // fe7f2d
- main: '#a8b735ff',
- dark: '#a8b735ff',
- },
- secondary: { main: '#5748ca' },
- background: { default: '#233d4d' },
- text: { primary: '#f8f8f2' },
- divider: '#555',
+export const getDarkThemes = (): Record<string, any> => {
+ const darkThemes: Record<string, any> = {};
+ darkThemes['darklegacy'] = {
+ mode: 'dark',
+ primary: {
+ light: AppConfig.ExtDarkThemeLightColor,
+ main: AppConfig.ExtDarkThemeMainColor, // #ff9abe
+ dark: AppConfig.ExtDarkThemeMainColor,
+ },
+ secondary: { main: '#006541' },
+ background: { default: '#282A36' },
+ divider: '#555',
+ };
+ darkThemes['dracula'] = {
+ mode: 'dark',
+ primary: {
+ light: '#503d50',
+ main: '#BD93F9',
+ dark: '#BD93F9',
+ },
+ secondary: { main: '#426c06' },
+ divider: '#555',
+ background: { default: '#282A36' },
+ text: { primary: '#f8f8f2' },
+ };
+ darkThemes['darkblue'] = {
+ mode: 'dark',
+ primary: {
+ light: '#a6def4',
+ main: '#3bc8ff',
+ dark: '#3bc8ff',
+ },
+ secondary: { main: '#c43700' },
+ background: { default: '#001E3C' },
+ text: { primary: '#f8f8f2' },
+ divider: '#555',
+ };
+ darkThemes['oilgreen'] = {
+ mode: 'dark',
+ primary: {
+ light: '#138086',
+ main: '#138086',
+ dark: '#04484cff',
+ },
+ secondary: { main: '#ec7f79' },
+ background: { default: '#000' },
+ text: { primary: '#f8f8f2' },
+ divider: '#555',
+ };
+ darkThemes['orangegreen'] = {
+ mode: 'dark',
+ primary: {
+ light: '#f3b759',
+ main: '#f3b759',
+ dark: '#fd8f52',
+ },
+ secondary: { main: '#0c48a6' },
+ background: { default: '#0d4a3a' },
+ text: { primary: '#f8f8f2' },
+ divider: '#555',
+ };
+ darkThemes['limecoal'] = {
+ mode: 'dark',
+ primary: {
+ light: '#a8b735ff', // fe7f2d
+ main: '#a8b735ff',
+ dark: '#a8b735ff',
+ },
+ secondary: { main: '#5748ca' },
+ background: { default: '#233d4d' },
+ text: { primary: '#f8f8f2' },
+ divider: '#555',
+ };
+ return darkThemes;
};
-export const lightThemes = {};
-lightThemes['legacy'] = {
- mode: 'light',
- primary: {
- light: AppConfig.ExtLightThemeLightColor,
- main: AppConfig.ExtLightThemeMainColor, // #1dd19f
- dark: AppConfig.ExtLightThemeMainColor,
- },
- secondary: { main: '#e22e60' },
- background: { default: '#fff' },
- divider: '#ddd',
-};
-lightThemes['newlight'] = {
- mode: 'light',
- primary: {
- light: '#a6def4',
- main: '#3bc8ff',
- dark: '#3bc8ff',
- },
- secondary: { main: '#c43700' },
- background: { default: '#f4f4f4ff' },
- divider: '#ddd',
-};
-lightThemes['orange'] = {
- mode: 'light',
- primary: {
- light: '#fcb272ff',
- main: '#ed7a13',
- dark: '#b45808ff',
- },
- secondary: { main: '#1285ec' },
- background: { default: '#f4f4f4ff' },
- divider: '#ddd',
-};
-lightThemes['herbal'] = {
- mode: 'light',
- primary: {
- light: '#b9d08fff',
- main: '#6a8042',
- dark: '#1e3006',
- },
- secondary: { main: '#957fbd' },
- background: { default: '#f4f4f4ff' },
- divider: '#ddd',
-};
-lightThemes['lemonblue'] = {
- mode: 'light',
- primary: {
- light: '#6a92baff',
- main: '#486989ff',
- dark: '#486989ff',
- },
- secondary: { main: '#b79676' },
- background: { default: '#f6f1dfff' },
- divider: '#ddd',
-};
-lightThemes['vanilablue'] = {
- mode: 'light',
- primary: {
- light: '#4c9db0',
- main: '#4c9db0',
- dark: '#4c9db0',
- },
- secondary: { main: '#b3624f' },
- background: { default: '#fbf0cdff' },
- divider: '#ddd',
+export const getLightThemes = (): Record<string, any> => {
+ const lightThemes: Record<string, any> = {};
+ lightThemes['legacy'] = {
+ mode: 'light',
+ primary: {
+ light: AppConfig.ExtLightThemeLightColor,
+ main: AppConfig.ExtLightThemeMainColor, // #1dd19f
+ dark: AppConfig.ExtLightThemeMainColor,
+ },
+ secondary: { main: '#e22e60' },
+ background: { default: '#fff' },
+ divider: '#ddd',
+ };
+ lightThemes['newlight'] = {
+ mode: 'light',
+ primary: {
+ light: '#a6def4',
+ main: '#3bc8ff',
+ dark: '#3bc8ff',
+ },
+ secondary: { main: '#c43700' },
+ background: { default: '#f4f4f4ff' },
+ divider: '#ddd',
+ };
+ lightThemes['orange'] = {
+ mode: 'light',
+ primary: {
+ light: '#fcb272ff',
+ main: '#ed7a13',
+ dark: '#b45808ff',
+ },
+ secondary: { main: '#1285ec' },
+ background: { default: '#f4f4f4ff' },
+ divider: '#ddd',
+ };
+ lightThemes['herbal'] = {
+ mode: 'light',
+ primary: {
+ light: '#b9d08fff',
+ main: '#6a8042',
+ dark: '#1e3006',
+ },
+ secondary: { main: '#957fbd' },
+ background: { default: '#f4f4f4ff' },
+ divider: '#ddd',
+ };
+ lightThemes['lemonblue'] = {
+ mode: 'light',
+ primary: {
+ light: '#6a92baff',
+ main: '#486989ff',
+ dark: '#486989ff',
+ },
+ secondary: { main: '#b79676' },
+ background: { default: '#f6f1dfff' },
+ divider: '#ddd',
+ };
+ lightThemes['vanilablue'] = {
+ mode: 'light',
+ primary: {
+ light: '#4c9db0',
+ main: '#4c9db0',
+ dark: '#4c9db0',
+ },
+ secondary: { main: '#b3624f' },
+ background: { default: '#fbf0cdff' },
+ divider: '#ddd',
+ };
+ return lightThemes;
};