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
[CssBaseline] Add colors with better constrast to <a> #38135
base: master
Are you sure you want to change the base?
Conversation
@danilo-leal Should this also be done for Joy UI? |
Netlify deploy preview
Bundle size reportDetails of bundle changes (Toolpad) |
Hey @brijeshb42 thanks for tackling this!
If the same thing is happening on Joy UI, I see no reason not to solve it there as well |
Do you want the same tokens there as well or different? |
Is it possible to use the Joy default theme? If so, you can use the primary 500 |
@zanivan I don't see the colors you've mentioned in the default theme. These are the |
Right, sorry, my mistake 😅 |
@@ -43,6 +43,10 @@ export const styles = (theme, enableColorScheme = false) => { | |||
'strong, b': { | |||
fontWeight: theme.typography.fontWeightBold, | |||
}, | |||
a: { | |||
color: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color: | |
color: (theme.vars || theme).palette.primary.main, |
I think primary.main
should be the best one for links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've followed @danilo-leal's pointer #38017 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siriwatknp Do you still want the change to reference theme.vars
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better as identical to what Link uses for design consistency
https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Link/Link.js (color + text decoration + hover)
in CssBaseline component for both light and dark modes
958e6ff
to
e6253b0
Compare
Is this even needed? I would expect Now, it makes sense to me to consider if we want design consistency from CssBaseline, I would expect Tailwind CSS and Bootstrap to reset the look of links as well. For v6, I wanted to revisit all the style in CssBaseline, e.g. https://moderncss.dev/modern-css-for-dynamic-component-based-architecture/. I mentioned it in #30660 |
@oliviertassinari This is mainly added so that the link colors are set to material/joy colors for both dark/light mode. Reset from tailwind or other solution don't do anything for the color. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! The colors I provided earlier were pulled from the company's branding theme, but it does sound like a good call to use each package's default theme colors, same tokens though. In summary:
- Material UI uses Material Design colors.
- Joy UI uses the Joy default theme colors.
- Continue to use 500 for light and 300 for dark mode.
@brijeshb42 I meant this https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js#L1245-L1249. |
The more we add style resets like this, the more I think in the future we can consider isolating each reset type:
In our case, maybe we shouldn't reset the |
@@ -43,6 +43,10 @@ export const styles = (theme, enableColorScheme = false) => { | |||
'strong, b': { | |||
fontWeight: theme.typography.fontWeightBold, | |||
}, | |||
a: { | |||
color: | |||
theme.palette.mode === 'dark' ? theme.palette.primary[300] : theme.palette.primary[700], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of which color we choose, we should also add the support for theme.vars as well. I would recommend adding this value as a palette key and use that directly instead of hardcoding the values in the CssBaseline
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mnajdova Can I ask you to double-check the second to last commit to see if I've done that correctly? 😬
a: { | ||
color: | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primary[300] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? theme.palette.primary[300] | |
? (theme.vars || theme).palette.primary[300] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brijeshb42 would an approach similar to what I pushed for the Material version work? It's following Marija's guidance and it definitely looks cleaner not having to call the dark mode ternary here 😬
in CssBaseline component for both light and dark modes
Fixes #38017
Light
Dark