PromucFlow_constructor/app/client/src/selectors/themeSelectors.tsx
devrk96 ac23629647
Feature: API Pane Redesign (#2218)
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-02-11 18:24:00 +05:30

28 lines
856 B
TypeScript

import { AppState } from "reducers";
import { dark, light, Theme, theme } from "constants/DefaultTheme";
export enum ThemeMode {
LIGHT = "LIGHT",
DARK = "DARK",
}
// 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 } };
};
// Use to get the current theme of the app set via the theme switcher
export const getCurrentThemeDetails = (state: AppState): Theme =>
state.ui.theme.theme;
// Use to get the current theme mode of the app set via the theme switcher
export const getCurrentThemeMode = (state: AppState) => state.ui.theme.mode;
export const getAppCardColorPalette = (state: AppState) => {
return state.ui.theme.theme.colors.appCardColors;
};