Reputation: 91
I need to white Pencil icon, I do:
<CreateIcon style={{ color: white[500] }} />
But "white" not exist in Material UI https://material-ui.com/customization/color/#official-color-tool
How I can used white color?
Upvotes: 2
Views: 5771
Reputation: 81833
As you may already know, white only has one color (#fff
). If you want to have different 'shade' of white, you can use grey if that's what you mean.
import grey from '@material-ui/core/colors/grey';
const useStyles = makeStyles((theme) => ({
white: {
color: grey[50],
},
}
render() {
const classes = useStyles();
...
return <CreateIcon className={classes.white}/>;
}
Upvotes: 1
Reputation: 1774
The easiest couple of ways are:
1)
<CreateIcon style={{ color: '#fff' }} />
or
2)
const useStyles = makeStyles((theme) => ({
white: {
color: theme.palette.common.white,
},
}
In your component:
const classes = useStyles();
..
<CreateIcon className={classes.white}/>
Upvotes: 2
Reputation: 14901
You could override style
const WhiteCreateIcon = withStyles({
root: {
color: "white"
}
})(CreateIcon);
Codesandbox demo
Upvotes: 1