hi I have a customised chip component for material-UI app where i am changing the background and border color of the chip by using the grey object
now when I am switching to dark mode via the global theme palette: { type: "dark" } those colors not changing. is there some way to change those custome colors based if we are in light or dark mode?
import React, { useState } from 'react';
import grey from'@material-ui/core/colors/grey';
import {Chip} from "@material-ui/core";
import {withStyles} from "@material-ui/core/styles";
const MyChip = withStyles(theme =>({
root: {
backgroundColor:grey[100],
borderStyle: "solid",
borderWidth: "1px",
borderColor: grey[300]
},
}))(Chip);
const ChipComponent = ({...props}) => {
return <MyChip {...props} />
}
export default ChipComponent;
backgroundColor: theme.darkMode ? grey[800] : grey[100],
– Ben StephensbackgroundColor: theme.palette.type === 'dark' ? grey[800] : grey[100]
? Hopefully it's just a matter of finding the correct property in theme to tell whether you're in dark mode or not. – Ben Stephens