Cannot change the body background via theme configuration
See original GitHub issueA question / suggestion or a potential bug.
I’m trying to configure a theme and when I try to change the background color the change does not get applied.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
With this theme configuration, I’m expecting the body
background color to be #ff0000
but it’s actually #cccccc
.
export default {
palette: {
type: 'light',
primary: {
main: '#00AAE1',
dark: '#143C8C',
contrastText: '#fff',
},
secondary: {
main: '#64B42D',
dark: '#008732',
contrastText: '#fff',
},
error: {
main: '#BD0043',
contrastText: '#fff',
},
divider: '#D7D6D5',
background: {
paper: '#fff',
default: "#ff0000"
},
},
typography: {
// Use the system font over Roboto.
fontFamily: 'Avenir Next, Roboto,"Helvetica Neue",Arial,sans-serif',
htmlFontSize: 16,
},
};
const theme = createMuiTheme(uiThemeConfig);
Current Behavior
The body
’s background color remains unchanged.
Steps to Reproduce (for bugs)
I found that having the <CssBaseline />
makes the background color possible.
https://codesandbox.io/s/kkpw0y1vm5
But without it doesn’t work. https://codesandbox.io/s/q4kvw1kj4q
I must have missed this in the documentation to be a mandatory part of the setup. If so, then please point me to it 😃
Your Environment
Tech | Version |
---|---|
Material-UI | 1.0.0-beta.38 |
React | 16.2.0 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:26 (15 by maintainers)
Top Results From Across the Web
Cannot change the body background via theme configuration
I'm trying to configure a theme and when I try to change the background color the change does not get applied. @mnemanja It's...
Read more >can't change body background color using CSS reset
Your CSS reset file sets the background color of html which is the entire page. You are only setting the body 's background...
Read more >Topic: Can't change background color of “body” in Neat
Looking at the theme, it appears that the body background is really an image (blue gradient) and not really a background-color.
Read more >I can't change the body background-color through style.css
It sounds like you just need to remove support for the custom background color. remove_theme_support( 'custom-background' );.
Read more >How To Change Entire Page Body Background Color In ...
In today's video tutorial we'll learn how to change the entire page body background color using Elementor WordPress plugin in a simple, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this issue and eventually realized that I was wrapping
<CssBaseline>
around the<MuiThemeProvider>
and not the other way around. This was causing<CssBaseline>
to not be aware of the theme configuration.KO 🔴
OK ✅
For reference, the CssBaseline documentation page.