question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Theme] Body background color is not being changed

See original GitHub issue

Describe the bug https://codesandbox.io/s/chakra-ts-starter-sn639

I have created a theme and changed the background however it is not being applied

const customTheme = {
  ...theme,
  colors: {
    ...theme.colors,
    background: "red.500"
  }
};

function App() {
  return (
    <ThemeProvider theme={customTheme}>
      <Heading>Welcome</Heading>
    </ThemeProvider>
  );
}

Expected Behavior The body background should change to red.500

To Reproduce https://codesandbox.io/s/chakra-ts-starter-sn639

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.6
  • Browser: Firefox Developer Edition
  • Version: 77.0b9

Additional context https://theme-ui.com/theming/, says here changing the body , changes the Body background color

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
santialbocommented, Jun 13, 2020

You can set the background color on the <CSSReset/> element. Check this updated codesanbox https://codesandbox.io/s/chakra-ts-starter-fn3yt?file=/src/index.tsx

const config = (theme: ITheme) => ({
  light: {
    color: theme.colors.gray[700],
    bg: theme.colors.red[500],
    borderColor: theme.colors.gray[200],
    placeholderColor: theme.colors.gray[500]
  },
  dark: {
    color: theme.colors.whiteAlpha[900],
    bg: theme.colors.gray[800],
    borderColor: theme.colors.whiteAlpha[300],
    placeholderColor: theme.colors.whiteAlpha[400]
  }
});

function App() {
  return (
    <ThemeProvider theme={theme}>
      <CSSReset config={config} />
      <Heading>Welcome</Heading>
    </ThemeProvider>
  );
}
0reactions
geocinecommented, Jun 15, 2020

Oh dang, thank you @santialbo , I think this works for me so I’ll be closing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

body background color not showing? - html - Stack Overflow
Check the network tab to make sure Stylesheets/main.css is getting loaded. Check the style inspector to make sure background-color is not being overridden....
Read more >
Site Background Color is not changing - WordPress.org
If you meant changing the overall skin color of the site to a lighter theme, go to Customizer->Global->Colors->Skin Color and you should see...
Read more >
Why is my background color not changing? - HTML-CSS
Ideally, outside of codepen, you would solve that by making sure that your CSS file is called after bootstrap one.
Read more >
Change the site background color in WordPress - GoDaddy
Note: If you have a premium WordPress theme, check the theme documentation on how to change the background color, because the following option...
Read more >
How to Change Text and Background Color in CSS
If there is no body selector or color defined in the body selector, the default color is most likely black. So let's say...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found