'MaterialUI theme does not change typography color
I am trying to change the color of Typography using a theme but it does not change the color. The color of "Hallo World 1" is still #3f51b5 and the color of "Hallo World 2" is rgba(0, 0, 0, 0.87).
I will accept any answer that does not include styling/css.
import { ThemeProvider } from '@mui/styles'
import { createTheme, Typography } from "@material-ui/core"
import createPalette from '@material-ui/core/styles/createPalette'
function App() {
return (
<>
<ThemeProvider theme={createTheme({
palette: createPalette({
primary: { main: 'rgb(255, 0, 0)', contrastText: '#fff' },
text: {
primary: 'rgb(0, 255, 0)',
}
})
})}>
<Typography color="primary">
Hallo World 1
</Typography>
<Typography color="textPrimary">
Hallo World 2
</Typography>
</ThemeProvider>
</>
);
}
export default App;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
