Material-ui: Change the color of <ListItem> icons via custom theme

Created on 21 Oct 2016  路  5Comments  路  Source: mui-org/material-ui

Problem description

image

This is a <Drawer> with a custom theme (I want the drawer in a dark theme, while the main content uses a light theme):

          <MuiThemeProvider muiTheme={sidebarTheme}>
            <Drawer
              docked={false}
              width={this.props.width}
              open={this.props.openDrawer}
              onRequestChange={this.handleDrawerChange}
            >
              {this.props.drawerContent}
            </Drawer>
          </MuiThemeProvider>

How can I change the color of the left icons?

This is the sidebarTheme I'm using:

import baseTheme from 'material-ui/styles/baseThemes/darkBaseTheme';

import * as colors from 'material-ui/styles/colors';

export default {
  ...baseTheme,
  palette: {
    ...baseTheme.palette,

    canvasColor: colors.green900,
    primary1Color: colors.lime500,

    // just testing:
    listItem: {
      leftIconColor: "#FFFF00",
      rightIconColor: "#FFFF00",
    },

    svgIcon: {
      color: "#FFFF00"
    }
  }
};

I can't find the right setting to change the icon - or, the setting does not work...

Versions

  • Material-UI: 0.16.0
  • React: 15.3.2
  • Browser: Google Chrome 54.0.2840.59 m (64-bit)
Drawer question

All 5 comments

@jampy: can you please provide a bin to reproduce the code that you provided?

The color of icons should be changed on the content of the drawer (probably <MenuItem /> components) which I can not tell by your code.

@lucasbento I would, but I don't know how to import icons in webpackbin.

@jampy: I just commented in the issue, I hope that works for you!

Closing this due to inactivity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

newoga picture newoga  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

revskill10 picture revskill10  路  3Comments

iamzhouyi picture iamzhouyi  路  3Comments