Skip to content
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

[docs] Remove custom primary & secondary color #26541

Merged
merged 5 commits into from
Jun 7, 2021

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Jun 1, 2021

closes #22112

https://deploy-preview-26541--material-ui.netlify.app/

After removing custom primary & secondary color, I found this issue in default primary color in dark mode. The color does not pass the AA standard and hard to see (affect all the components).

image

Other solution

Instead of fixing docs to be default theme, should we take this opportunity to do the opposite?

Solution 1

fix default theme to have same color as the docs (Note that the current docs has different color between light & dark mode)

Solution 2

find the new default color that works with light & dark mode and apply to docs as well.
However, from material design color tool, I don't see a color that pass AA standard for both light & dark mode. the best color that I tried so far is #1976d2 = blue[700] https://webaim.org/resources/contrastchecker/?fcolor=1976D2&bcolor=121212

I lean toward having different primary & secondary color (same palette but lighter in dark mode) between light and dark mode. https://material.io/design/color/dark-theme.html

related to #18378

cc @mui-org/core

docs/pages/_document.js Outdated Show resolved Hide resolved
@mui-pr-bot
Copy link

mui-pr-bot commented Jun 1, 2021

Details of bundle changes (experimental)

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@material-ui/styles: parsed: +Infinity% , gzip: +Infinity%
@material-ui/private-theming: parsed: +Infinity% , gzip: +Infinity%
@material-ui/system: parsed: +Infinity% , gzip: +Infinity%
@material-ui/unstyled: parsed: +Infinity% , gzip: +Infinity%
@material-ui/utils: parsed: +Infinity% , gzip: +Infinity%

Generated by 🚫 dangerJS against 533bdab

@@ -106,6 +106,7 @@ const useStyles = makeStyles(
/* Isolate the demo with an outline. */
demoBgOutlined: {
padding: theme.spacing(3),
backgroundColor: theme.palette.background.paper,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the demo looks the same as codesandbox when apply darkmode

image

Copy link
Member

@oliviertassinari oliviertassinari Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for the direction taken by the outcome. It seems better to render the demos under theme.palette.background.default.

However, why use the paper design token? Why not apply the same background color to the whole page?

Copy link
Member Author

@siriwatknp siriwatknp Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Here, if the whole page has the same background, everything blend together and hard to focus. On the other hand, if the demo is the darkest it catches the eye instantly. Also the contrast of demo and bg help separate between each demo.

Copy link
Member

@oliviertassinari oliviertassinari Jun 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I would add that there are different demos variant. We have:

I almost feel like "bg": true should be the current "bg": "outlined" and "bg": "outlined" should have the bgcolor of "bg": "inline". Not sure, I'm not in my comfort zone with design 😁

@siriwatknp siriwatknp changed the title remove custom primary and secondary color in docs [docs] Remove custom primary & secondary color Jun 1, 2021
@siriwatknp siriwatknp added the docs Improvements or additions to the documentation label Jun 1, 2021
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you are describing looks completely accurate. The patch of the documentation was a short-term focused solution to not rework the default theme.

I would personally do this change last, once we have fixed the core.

Regarding light vs. dark mode color, there is #18776. I don't think that we can use the same colors (primary included) between light and dark mode.

docs/pages/_document.js Outdated Show resolved Hide resolved
docs/src/modules/components/AppFrame.js Outdated Show resolved Hide resolved
@@ -106,6 +106,7 @@ const useStyles = makeStyles(
/* Isolate the demo with an outline. */
demoBgOutlined: {
padding: theme.spacing(3),
backgroundColor: theme.palette.background.paper,
Copy link
Member

@oliviertassinari oliviertassinari Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for the direction taken by the outcome. It seems better to render the demos under theme.palette.background.default.

However, why use the paper design token? Why not apply the same background color to the whole page?

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Even get's rid of links within <code /> segments not meeting AA contrast ratios 👍

might also close #18378

Careful with these statements. GitHub will close the referenced issue if this PR is merged.

@siriwatknp siriwatknp marked this pull request as ready for review June 2, 2021 11:38
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better!

@mnajdova
Copy link
Member

mnajdova commented Jun 2, 2021

Agree on using different primary & secondary colors in light and dark mode. 👍

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 3, 2021

@siriwatknp Before we merge this one. What do you think about:

  1. Getting [AppBar] Fix background color on dark mode #26545 first. It starts to remove the custom CSS used by the documentation.
  2. Getting [theme] Improve default primary, secondary and error theme palette #26555 second. It will allow using the default color of the theme in the documentation.

@siriwatknp siriwatknp merged commit c73c55e into mui:next Jun 7, 2021
@siriwatknp siriwatknp deleted the docs-default-theme branch June 7, 2021 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] Sync default theme with the theme used by the documentation
5 participants