2020-09-16 11:50:47 +00:00
|
|
|
import { AppState } from "reducers";
|
2021-02-11 12:54:00 +00:00
|
|
|
import { dark, light, Theme, theme } from "constants/DefaultTheme";
|
2021-01-27 06:12:32 +00:00
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
export enum ThemeMode {
|
|
|
|
|
LIGHT = "LIGHT",
|
|
|
|
|
DARK = "DARK",
|
|
|
|
|
}
|
2021-02-04 07:02:36 +00:00
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
// Only for usage with ThemeProvider
|
|
|
|
|
export const getThemeDetails = (
|
|
|
|
|
state: AppState,
|
|
|
|
|
themeMode: ThemeMode,
|
|
|
|
|
): Theme => {
|
|
|
|
|
const colors = themeMode === ThemeMode.LIGHT ? light : dark;
|
|
|
|
|
return { ...theme, colors: { ...theme.colors, ...colors } };
|
|
|
|
|
};
|
2021-02-04 07:02:36 +00:00
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
// Use to get the current theme of the app set via the theme switcher
|
|
|
|
|
export const getCurrentThemeDetails = (state: AppState): Theme =>
|
|
|
|
|
state.ui.theme.theme;
|
2021-01-27 06:12:32 +00:00
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
// Use to get the current theme mode of the app set via the theme switcher
|
|
|
|
|
export const getCurrentThemeMode = (state: AppState) => state.ui.theme.mode;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
export const getAppCardColorPalette = (state: AppState) => {
|
2020-09-16 11:50:47 +00:00
|
|
|
return state.ui.theme.theme.colors.appCardColors;
|
|
|
|
|
};
|