[Typography] Cannot customize primary/error color
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
<Typography color="primary"> doesn't allow customizing the color:
-
color="primary"doesn't add any classes that we could use for styling. -
styleOverridesdoesn't support theprimaryorcolorPrimarykey:styleOverrides: { primary: { color: palette.primary[palette.mode === "dark" ? "light" : "main"] }, } -
New component variant has no effect:
variants: [ { props: { color: "primary" }, style: { color: palette.primary[palette.mode === "dark" ? "light" : "main"] }, }, ],
Same applies for color="error".
Expected behavior 🤔
Typography provides some way to change the color of color="primary" into palette.primary[palette.mode === "dark" ? "light" : "main"], and same for color="error".
Steps to reproduce 🕹
https://codesandbox.io/s/brave-spence-5wxolh?file=/demo.js
Context 🔦
We're maintaining a UI library based on MUI, so we can't fix this at the <Typography> call site. So we can't do for example <Typography color={palette.primary[palette.mode === "dark" ? "light" : "main"]}>.
Your environment 🌎
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Typography component and reproduce the behavior from the linked CodeSandbox using color="primary" and color="error". Review how styleOverrides and theme variants are applied to these color props. Done means theme customization changes both colors without requiring changes at each Typography call site.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- design, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100