croraf
croraf

Reputation: 4720

material-ui v.1 - define component's background with theme

I'm using material-ui v.1 library for React, and want to set background of Paper components.

I want to do that using themes.

I'm using top level

const theme = createMuiTheme({
    palette: {
        //type: 'light'
    }
});

<MuiThemeProvider theme={theme}>
</MuiThemeProvider>

What should I put in createMuiTheme to do that?

I've tried several options (like palette:{paper: {backgroundColor: 'black'}}, and paper: {backgroundColor: 'black'}, and backgroundColor: {paper: 'black'}) but nothing works.

NOTE: type: 'light', type: 'dark' works fine.

Upvotes: 4

Views: 2534

Answers (2)

croraf
croraf

Reputation: 4720

According to https://material-ui-next.com/customization/themes/, the following property should be used :

const theme = createMuiTheme({
    palette: {
        background: {
            paper: 'red'
        }
    }
});

Upvotes: 5

Matt
Matt

Reputation: 3780

If you take a look at the themes documentation you will see:

{
  "palette": {
    "shades": {
      "light": {
        "background": {
          "paper": "#fff",
        },
      },
    },
  },
}

Upvotes: 0

Related Questions