Default Theme
Theme configuration variables
import { useMemo } from 'react';
// material-ui
import { createTheme, PaletteOptions, ThemeProvider, TypographyVariantsOptions } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
// project imports
import palette from './palette';
import componentsOverride from './overrides';
import Shadows from './shadow';
import typography from './typography';
import RTLLayout from 'components/RTLLayout';
import useConfig from 'hooks/useConfig';
// types
import { ChildrenProps } from 'types/root';
// ==============================|| DEFAULT THEME - MAIN ||============================== //
export default function ThemeCustomization({ children }: ChildrenProps) {
const { mode, themeDirection } = useConfig();
const themePalette = useMemo<PaletteOptions>(() => palette(mode), [mode]);
const themeDefault = createTheme({
direction: themeDirection,
palette: themePalette,
customShadows: {}
});
// create duplicate theme due to responsive typography and fontFamily
const theme = createTheme({
...themeDefault,
typography: typography() as TypographyVariantsOptions,
customShadows: Shadows(themeDefault)
});
theme.components = componentsOverride(theme);
return (
<ThemeProvider {...{ theme }}>
<CssBaseline enableColorScheme />
<RTLLayout>{children}</RTLLayout>
</ThemeProvider>
);
}
Last updated