Can anyone suggest a function from material UI that can automatically change text color to either white or black based on the background color? For example:
<AppBar color="primary">
<Toolbar>
<Typography color="inherit" > some text </Typography>
</Toolbar>
</AppBar>
If the primary color is dark, MUI will change the text color to white; if it's light, the text color will be changed to black.
Is there a specific function or method that can achieve this functionality automatically?
I have tried using the CSS property
mix-blend-mode: "difference"
However, this does not result in black/white text like in MUI, but rather creates visible contrast. Any suggestions?