Omer Cohen
Omer Cohen

Reputation: 68

how to set up a dynamic text color with material ui, react

Is there a way one can set a dynamic text-color depends on component background-color, using Material-UI API,

component A has Light BG => Dark Text, component B has Black BG => Light Text

( I can achieve this using tinyColor API on single-components, looking for more general use case )

Thanks!

Upvotes: 0

Views: 173

Answers (1)

Jake
Jake

Reputation: 4255

You can use theme.palette.getContrastText()

Upvotes: 1

Related Questions