import Typography from '@mui/material/Typography'; import Grid from '@mui/material/Grid'; import Box from '@mui/material/Box'; import { styled, ThemeProvider, useTheme, createTheme } from '@mui/material/styles'; const Root = styled('div')(({ theme }) => ({ backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, padding: theme.spacing(2), borderRadius: 4, [theme.breakpoints.up('md')]: { padding: theme.spacing(3), }, })); const Color = styled(Grid)(({ theme }) => ({ display: 'flex', alignItems: 'center', '& div:first-of-type': { width: theme.spacing(5), height: theme.spacing(5), flexShrink: 0, marginRight: theme.spacing(1.5), borderRadius: theme.shape.borderRadius, }, })); function Demo() { const theme = useTheme(); const item = (color, name, expanded = false, border = false) => (
{name} {color}
); return ( Typography {item(theme.palette.text.primary, 'palette.text.primary')} {item(theme.palette.text.secondary, 'palette.text.secondary')} {item(theme.palette.text.disabled, 'palette.text.disabled')} Buttons {item(theme.palette.action.active, 'palette.action.active')} {item(theme.palette.action.hover, 'palette.action.hover')} {item(theme.palette.action.selected, 'palette.action.selected')} {item(theme.palette.action.disabled, 'palette.action.disabled')} {item( theme.palette.action.disabledBackground, 'palette.action.disabledBackground', true, )} Background {item( theme.palette.background.default, 'palette.background.default', false, true, )} {item( theme.palette.background.paper, 'palette.background.paper', false, true, )} Divider {item(theme.palette.divider, 'palette.divider')} ); } const darkTheme = createTheme({ palette: { // Switching the dark mode on is a single property value change. mode: 'dark', }, }); export default function DarkTheme() { return ( ); }