When creating a theme for colors with Material-UI, I set contrast text to white (#fff). It is working for the button with primary color, but not secondary.
Tried overrides as described here: Material UI: Unable to change button text color in theme. If an override will solve it, then I need help writing one.
const colortheme = createMuiTheme({
palette: {
primary: { main: '#e91e63' },
secondary: { main: '#03a9f4' },
contrastText: '#fff',
}
});
Expecting both buttons to have white text. Instead got one button black:
Edit: I created the theme and rendered Material UI's SimpleModal component on the parent, passing theme props to the child. The button is rendered on the child.
parent:
const blues = createMuiTheme({
palette: {
primary: { main: '#00e5ff' },
secondary: { main: '#2979ff' },
contrastText: '#fff'
}
})
<SimpleModal label="content" theme={blues} color="primary" document="content" />
child:
<div>
<MuiThemeProvider theme={this.props.theme}>
<Button className={classes.margin} variant="contained" color={this.props.color} onClick={this.handleOpen}>{this.props.label}</Button>
</MuiThemeProvider>
<Modal open={this.state.open} onClose={this.handleClose}>
<div style={getModalStyle()} className={classes.paper}>
<Typography variant="h6" id="modal-title">{this.state.reference}</Typography>
<Typography variant="subtitle1" id="simple-modal-description">{this.state.content}</Typography>
</div>
</Modal>
</div>