-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Theme] support for 'on' colors? #17241
Comments
Yes, |
It is, (although it predates the spec having such a concept), but it isn't possible to apply it to typography (using the color prop). Also, while the v2 spec doesn't distinguish between primary and primary variant when it comes to the contrast color, it may be that it needs to be different for main / light / dark. We could add @petegivens For the moment you have access to |
This is true. There's no way to know in advance which level of the primary palette will require white or black text on top of it. Even MaterialUI's system of having
That's the approach we'll take for now. I think adding the The Button example I listed above is not part of MD spec AFAIK--they seem to only advocate using |
Light and dark do work with 900 colors. You can try it in the docs. If the calculated light and dark values don't work for you, you can adjust |
I don't understand how that's working. If I set my |
Looked up the source code and it seems that my assumption is correct. The color tool calls I wonder if our understanding of the material color palette is wrong, and our main primary color should always be primary500? |
Even if you provide a 500 color for main, light and dark won't be "approved" colors, as they are calculated rather than using the palette colors. You have to provide specific colors for light, main and dark if you want to strictly follow the v1 spec colors. Google have opened up to non v1 palette colors anyway:
Custom colors in the palette tool: https://material.io/resources/color/#!/?view.left=0&view.right=1&primary.color=7f2644 |
@mbrookes Great point. I did a quick fuzzy search for I appreciate the discussion. I don't have any more questions at this point so feel free to close this issue. I do think that adding |
I have no objection to them being added. |
@petegivens The latest strategy is to allow people to use any color from their palette in the core component, moving the system in the core #15561: https://material-ui.com/system/palette/#color . I would imagine that |
This issue is outdated (MD2 related). We aim to have a fresh look for Material UI in the near future, so I’m closing this. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @petegivens How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
The Material Design docs advocate for theme palette values for "on" colors like
onPrimary
,onSurface
, etc. Are there plans to support these in thetheme.palette
object?Summary 💡
I'm just looking to understand the philosophy and if this is on the roadmap. I'm working on a white label application that needs to support a robust theming solution. We have embraced the (newer) MD theme model where svg strokes and typography are colored based on these "on" colors. If text appears on top of a primary colored surface, it uses the
onPrimary
color.We have also extended this to the color prop on small components. E.G. our
Button
can takecolor="primary"
orcolor="onPrimary"
.When I look through Material UI's default theme, it looks like the palette shape hasn't changed since MD1. The palette still supports accent colors, for example, which are no longer part of the MD2 color palette recommendations. I assume that the
palette.primary.contrastText
value is supposed to represent this?Can we expect to see support for these 'on' colors in the
theme.palette
object or in the component APIs in the future?Examples 🌈
The text was updated successfully, but these errors were encountered: