I have a basic layout with an AppBar, Drawer and the page content Inside the content i have a Dialog that will open when a user clicks on a button.
Once the dialog is open, the AppBar color changes to white
All of the code is copied straight from the material ui page, no customization has been done to it.
Does anybody know why this is happening or how to fix it ?
const AppBar = styled(MuiAppBar, {
shouldForwardProp: (prop) => prop !== 'open',
})<AppBarProps>(({ theme, open }) => ({
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
...(open && {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
}),
}));
() => (
<AppBar position="fixed" open={open}>
<Toolbar>
<Box
display="flex"
justifyContent="space-between"
alignItems="center"
width="100%"
>
<Box display="flex" alignItems="center">
{showSidebar && (
<IconButton
color="inherit"
aria-label="open drawer"
onClick={handleDrawerOpen}
edge="start"
sx={{
marginRight: '36px',
...(open && { display: 'none' }),
}}
>
<MenuIcon />
</IconButton>
)}
<Typography
variant="h6"
noWrap
component={Link}
to={AppRoute.home}
>
Title
</Typography>
</Box>
<Box>
<Button component={Link} to={AppRoute.login} color="inherit">
Login
</Button>
</Box>
</Box>
</Toolbar>
</AppBar>
);
// createTheme file
const createBaseTheme = (isDarkMode: boolean): Theme =>
createTheme({
palette: {
mode: isDarkMode ? 'dark' : 'light',
primary: { main: '#2c3e50', light: '#34495e', dark: '#2c3e50' },
secondary: { main: '#2980b9', light: '#3498db' },
tertiary: { main: '#8e44ad' },
warning: { main: '#f39c12' },
error: { main: '#e74c3c' },
divider: 'rgb(255,255,255,0.2)',
shade,
},
});
export default createBaseTheme;
I have tried setting the AppBar background color by hand to the theme primary main color. Still the same result.

