TagSpaces is an offline, open source, document manager with tagging support
add themeDarkSelector and themeLightSelector
sytolke36d48c07b7e
diff --git a/app/components/dialogs/settings/SettingsGeneral.tsx b/app/components/dialogs/settings/SettingsGeneral.tsxindex bd021ec27..6571be91b 100644--- a/app/components/dialogs/settings/SettingsGeneral.tsx+++ b/app/components/dialogs/settings/SettingsGeneral.tsx@@ -73,6 +73,8 @@ interface Props {persistTagsInSidecarFile: boolean;toggleShowUnixHiddenEntries: () => void;setCurrentTheme: (theme: string) => void;+ setCurrentLightTheme: (theme: string) => void;+ setCurrentDarkTheme: (theme: string) => void;setLanguage: (language: string) => void;setCheckForUpdates: (check: boolean) => void;reorderTags: (check: boolean) => void;@@ -165,6 +167,36 @@ function SettingsGeneral(props: Props) {))}</Select></ListItem>+ <ListItem className={classes.listItem}>+ <ListItemText primary={i18n.t('core:themeLightSelector')} />+ <Select+ data-tid="settingsCurrentLightThemeTID"+ value={props.settings.currentLightTheme}+ onChange={(event: any) => props.setCurrentLightTheme(event.target.value)}+ input={<Input id="themeLightSelector" />}+ >+ {props.settings.supportedLightThemes.map(theme => (+ <MenuItem key={theme} value={theme}>+ {theme}+ </MenuItem>+ ))}+ </Select>+ </ListItem>+ <ListItem className={classes.listItem}>+ <ListItemText primary={i18n.t('core:themeDarkSelector')} />+ <Select+ data-tid="settingsCurrentDarkThemeTID"+ value={props.settings.currentDarkTheme}+ onChange={(event: any) => props.setCurrentDarkTheme(event.target.value)}+ input={<Input id="themeDarkSelector" />}+ >+ {props.settings.supportedDarkThemes.map(theme => (+ <MenuItem key={theme} value={theme}>+ {theme}+ </MenuItem>+ ))}+ </Select>+ </ListItem><ListItem className={classes.listItem}><ListItemText primary={i18n.t('Default Perspective')} /><PerspectiveSelectordiff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.tsindex 220d1d001..0c6ad5794 100644--- a/app/reducers/settings-default.ts+++ b/app/reducers/settings-default.ts@@ -169,6 +169,8 @@ export default {tagTextColor: 'white',tagBackgroundColor: '#61DD61',currentTheme: 'light',+ currentLightTheme: 'solarized',+ currentDarkTheme: 'dracula',geoTaggingFormat: 'pluscodes',defaultPerspective: PerspectiveIDs.GRID,enableGlobalKeyboardShortcuts: true,@@ -178,6 +180,8 @@ export default {mainVSplitSize: '50%',supportedGeoTagging: ['pluscodes', 'mgrs'],supportedThemes: ['light', 'dark', 'system'],+ supportedLightThemes: ['light1', 'solarized'],+ supportedDarkThemes: ['dark1', 'dracula'],tsLastOpenedFilesHistory: 10,tsLastOpenedFoldersHistory: 10,tsLastEditedFilesHistory: 10,diff --git a/app/reducers/settings.ts b/app/reducers/settings.tsindex 9e7da90e4..edd4ef145 100644--- a/app/reducers/settings.ts+++ b/app/reducers/settings.ts@@ -61,6 +61,8 @@ export const types = {SET_TAGCOLOR: 'SETTINGS/SET_TAGCOLOR',SET_TAGTEXTCOLOR: 'SETTINGS/SET_TAGTEXTCOLOR',SET_CURRENTTHEME: 'SETTINGS/SET_CURRENTTHEME',+ SET_CURRENT_LIGHT_THEME: 'SETTINGS/SET_CURRENT_LIGHT_THEME',+ SET_CURRENT_DARK_THEME: 'SETTINGS/SET_CURRENT_DARK_THEME',SET_GEO_TAGGING_FORMAT: 'SETTINGS/SET_GEO_TAGGING_FORMAT',SET_HISTORY: 'SETTINGS/SET_HISTORY',SWITCH_THEME: 'SETTINGS/SWITCH_THEME',@@ -128,7 +130,12 @@ export default (state: any = defaultSettings, action: any) => {...defaultSettings,...state,currentTheme: window.ExtTheme || state.currentTheme,+ currentLightTheme: window.ExtLightTheme || state.currentLightTheme,+ currentDarkTheme: window.ExtDarkTheme || state.currentDarkTheme,+ // TODO dynamically add supportedThemes functionalitysupportedThemes: defaultSettings.supportedThemes, // taking always the themes from default settings+ supportedLightThemes: defaultSettings.supportedLightThemes, // taking always the themes from default settings+ supportedDarkThemes: defaultSettings.supportedDarkThemes, // taking always the themes from default settingssupportedLanguages: defaultSettings.supportedLanguages, // taking always the languages from default settingskeyBindings: [// ...defaultSettings.keyBindings, // use to reset to the default key bindings@@ -246,6 +253,12 @@ export default (state: any = defaultSettings, action: any) => {case types.SET_CURRENTTHEME: {return { ...state, currentTheme: action.currentTheme };}+ case types.SET_CURRENT_LIGHT_THEME: {+ return { ...state, currentLightTheme: action.currentLightTheme };+ }+ case types.SET_CURRENT_DARK_THEME: {+ return { ...state, currentDarkTheme: action.currentDarkTheme };+ }case types.SET_GEO_TAGGING_FORMAT: {return { ...state, geoTaggingFormat: action.geoTaggingFormat };}@@ -586,6 +599,14 @@ export const actions = {type: types.SET_CURRENTTHEME,currentTheme}),+ setCurrentLightTheme: (currentLightTheme: string) => ({+ type: types.SET_CURRENT_LIGHT_THEME,+ currentLightTheme+ }),+ setCurrentDarkTheme: (currentDarkTheme: string) => ({+ type: types.SET_CURRENT_DARK_THEME,+ currentDarkTheme+ }),setGeoTaggingFormat: (geoTaggingFormat: string) => ({type: types.SET_GEO_TAGGING_FORMAT,geoTaggingFormatdiff --git a/app/tagspaces.d.ts b/app/tagspaces.d.tsindex 4560cf809..28ac3b8d2 100644--- a/app/tagspaces.d.ts+++ b/app/tagspaces.d.ts@@ -38,6 +38,8 @@ declare interface Window {ExtLocations?: Array<any>;ExtSearches?: Array<any>;ExtTheme?: string;+ ExtLightTheme?: string;+ ExtDarkTheme?: string;ExtIsFirstRun?: boolean;ExtIsAmplify?: boolean;ExtUseSidecarsForFileTagging?: boolean;