Crema React
Search…
Template Mode
Two template modes are available in the Crema i.e. Light and Dark. You can choose any one of the those according to your choice. Switching between the Modes is very easy.
Two template modes are available in the Crema i.e. Light and Dark. You can choose any one of the those according to your choice. Switching between the Modes is very easy.
Changing Template Mode in run time:-
Click on the Settings button on the right corner of the screen just below the notification icon, a drawer will open in which you will find Template Mode Option and from there, you can choose between Light and Dark Mode.
Changing Template Mode in development mode (setting default Mode) :-
To set the default Template Mode(Light/Dark), go to the following file:-
1
src/@crema/utility/AppContextProvider/defaultConfig.tsx
Copied!
In this file, you will find a property named 'themeMode'. You need to set the value of 'themeMode' according to your choice from the accepted values. You can find the accepted values of 'themeMode' in the file with the path src/shared/constants/AppEnums.js:-
1
const defaultConfig = {
2
themeMode: ThemeMode.LIGHT,
3
};
4
5
here is the both options of the theme mode
6
export const ThemeMode = {
7
LIGHT: 'light',
8
DARK: 'dark',
9
};
Copied!
For Setting Dark/Light mode, you need to follow one more step :-
In the 'defaultConfig.js' file, there is a object type property named "palette" which contains some template related properties. In the palette object, there is a property named 'type', you need to set the value of type to 'ThemeMode.DARK'. After that, you need to set the background color and text color present in the 'palette' property according to your choice. In case, you don't want to set the color, simply remove the 'background' and 'text' property, then the template will take the background and text color according to Material UI default colors.
Look at the image for reference:-​
Crema Theme Mode
Don't Forgot to change the default sidebar color scheme regarding your requirement as below
Here is the default configuration of the sidebar color
1
const defaultConfig = {
2
sidebar: {
3
borderColor: '#757575',
4
menuStyle: MenuStyle.DEFAULT,
5
isSidebarBgImage: false,
6
sidebarBgImage: 1,
7
colorSet: LightSidebar, //change this as your requremt light and dark
8
},
9
......
10
}
11
12
######### Two different sidebar color set defied #########
13
14
export const DarkSidebar = {
15
sidebarBgColor: '#313541',
16
sidebarTextColor: '#fff',
17
sidebarHeaderColor: '#313541',
18
sidebarMenuSelectedBgColor: '#F4F7FE',
19
sidebarMenuSelectedTextColor: 'rgba(0, 0, 0, 0.87)',
20
mode: ThemeMode.DARK,
21
};
22
23
export const LightSidebar = {
24
sidebarBgColor: '#fff',
25
sidebarTextColor: 'rgba(0, 0, 0, 0.60)',
26
sidebarHeaderColor: '#fff',
27
sidebarMenuSelectedBgColor: '#F4F7FE',
28
sidebarMenuSelectedTextColor: 'rgba(0, 0, 0, 0.87)',
29
mode: ThemeMode.LIGHT,
30
};
Copied!
Copy link