-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Styles] expose getContrastText method #18577
Comments
The method depends on the theme to behave correctly (have a look at the implementation to see the dependencies). I would suggest two possible alternatives. 1. You can start from a lower level helper: |
I can't find about |
Yeah, we have an open issue about adding documention for our color helpers. |
I just ran into/discovered this issue because I need to use |
Motivation 🔦
Suppose, the app has 3 different types of
background-color
like twitter, by exposinggetContrastText
method it can really help to make custom themes. Currently, there is no way of calculating contrastingtext.primary
color when creating a theme withcreateMuiTheme
We can get
getContrastText
by callinguseTheme
hook. But I suppose It can be used standalone without calling the hook just like lighten, darken, getContrastRatio methods.The text was updated successfully, but these errors were encountered: