-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Improve default theme dark colors #18776
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@oliviertassinari If you take care to follow the link I put in Steps to Reproduce, you will see that using |
Oh, I see, then it's about picking a color with enough contrast :) |
What do you think of the following? https://material.io/design/color/dark-theme.html diff --git a/packages/material-ui/src/styles/createPalette.js b/packages/material-ui/src/styles/createPalette.js
index 4df6b5efc..b89dd0c19 100644
--- a/packages/material-ui/src/styles/createPalette.js
+++ b/packages/material-ui/src/styles/createPalette.js
@@ -79,16 +79,8 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
export default function createPalette(palette) {
const {
- primary = {
- light: indigo[300],
- main: indigo[500],
- dark: indigo[700],
- },
- secondary = {
- light: pink.A200,
- main: pink.A400,
- dark: pink.A700,
- },
+ primary: primaryOption,
+ secondary: secondaryOption,
error = {
light: red[300],
main: red[500],
@@ -100,6 +92,32 @@ export default function createPalette(palette) {
...other
} = palette;
+ const primary =
+ primaryOption || type === 'light'
+ ? {
+ light: indigo[300],
+ main: indigo[500],
+ dark: indigo[700],
+ }
+ : {
+ light: indigo[100],
+ main: indigo[200],
+ dark: indigo[300],
+ };
+
+ const secondary =
+ secondaryOption || type === 'light'
+ ? {
+ light: pink.A200,
+ main: pink.A400,
+ dark: pink.A700,
+ }
+ : {
+ light: pink[100],
+ main: pink[200],
+ dark: pink[300],
+ };
+
// Use the same logic as
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54 |
Ran into the above stated issue of the Link object not respecting light and dark variants defined in the theme. Started on a PR for a possible fix. |
@Davst what do you think of #19105 (comment) |
Current Behavior 😯
The primary and secondary colors are identical between the light and dark theme.
Expected Behavior 🤔
The color should becomes less saturated as in the demos of the documentation and as specified by the Material Design specification.
Steps to Reproduce 🕹
https://codesandbox.io/s/material-ui-dark-theme-41nm4
Your Environment 🌎
The text was updated successfully, but these errors were encountered: