-
-
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
[core] Revise the theme.palette.primary & secondary approach #9794
Conversation
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.
Awesome start :)
@@ -4,14 +4,14 @@ import { create, SheetsRegistry } from 'jss'; | |||
import rtl from 'jss-rtl'; | |||
import { createMuiTheme, createGenerateClassName, jssPreset } from 'material-ui/styles'; | |||
import blue from 'material-ui/colors/blue'; | |||
import pink from 'material-ui/colors/pink'; | |||
import orange from 'material-ui/colors/orange'; |
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.
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.
Wait no, please revert, the contrast was 4.01 and it's 2.16 now.
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.
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.
Dude, please read: #9794 (comment) It's temporary. 😄 (But if we were going to change this, darkOrange
might be a nice compromise.)
package.json
Outdated
"test:unit": "cross-env NODE_ENV=test mocha test/**/*.spec.js src/{,**/}*.spec.js", | ||
"test:watch": "yarn test:unit -w", | ||
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc mocha test/**/*.spec.js src/{,**/}*.spec.js && nyc report -r lcovonly", | ||
"test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc mocha test/**/*.spec.js src/{,**/}*.spec.js && nyc report --reporter=html", | ||
"test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js --single-run", | ||
"test:regressions": "webpack --config test/regressions/webpack.config.js && rimraf test/regressions/screenshots/chrome/* && vrtest run --config test/vrtest.config.js --record", | ||
"typescript": "tsc -p tsconfig.json", | ||
"flow": "flow --show-all-errors", | ||
"flow": "echo \"No flow.\"", |
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.
Wait. We still use internally for some of our files. Please put it back.
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.
Relax
src/Form/FormLabel.js
Outdated
@@ -4,7 +4,8 @@ import classNames from 'classnames'; | |||
import withStyles from '../styles/withStyles'; | |||
|
|||
export const styles = theme => { | |||
const focusColor = theme.palette.primary[theme.palette.type === 'light' ? 'A700' : 'A200']; | |||
// FIXME: 'dark' & 'light' were accent colors before the theme change |
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.
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.
src/Input/Input.js
Outdated
@@ -74,7 +74,8 @@ export const styles = theme => { | |||
}, | |||
inkbar: { | |||
'&:after': { | |||
backgroundColor: theme.palette.primary[theme.palette.type === 'light' ? 'A700' : 'A200'], | |||
// FIXME: 'dark' & 'light' were accent colors before the theme change |
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's reducing entropy 👍 .
src/Progress/LinearProgress.js
Outdated
@@ -13,27 +13,27 @@ export const styles = theme => ({ | |||
height: 5, | |||
}, | |||
primaryColor: { | |||
backgroundColor: theme.palette.primary[100], | |||
backgroundColor: theme.palette.primary.light, |
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.
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.
@oliviertassinari:
We can use A200 for A100
Yeah, I had my doubts about that. lighten()
it is.
secondary = pink, | ||
error = red, | ||
primary = { | ||
light: indigo[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.
Question, why using 300 and not a lighter version of indigo[500]
?
(we could just remove this line so the default logic quicks in)
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.
Bacuase it's the "correct" color according to the MD spec. But we can approximate if you're happy with that.
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.
Sounds good :)
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.
Sorry, which?
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.
@mbrookes Your argument sounds good. I thought MCW was doing the opposite.
type = 'light', | ||
// Same value used by material-components-web | ||
// https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L49 | ||
contrastThreshold = 3.1, | ||
contrastThreshold = 3, |
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.
3.1 so we better follow the specification. Compare https://material-ui.com/style/color/#color with https://material.io/guidelines/style/color.html#color-color-palette.
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's déjà vu all over again". 😄
- That isn't the spec for contrast color it's the spec for the color pallette. The text is simply labels, so it doesn't matter that they're different.
- our current color tables' labels don't match the spec in places if you compare them.
This is the best default for end users IMHO. If you really want the docs color table labels closer to the labels in the spec (contrastThreshold = 3.1
doesn't exactly match either), we can override it in the docs.
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 won't argue for 0.1. Fine.
@oliviertassinari I think we're nearly there. The only thing I'm wondering is if we should add If so, we could do the same for primary / secondary, and keep the Input underline etc. consistent with the current implementation. |
@mbrookes Why do we use two different error colors in the first place 😮 ? Something is wrong here, nothing is justifying us using two different values here 🙈 :
I could only find one occurrence of the error color on material-components-web side, they are using |
I don't know why for sure, but it does seem |
#8075 (comment) Closes 8075 Revise the theme.palette.primary & secondary approach Update & expand createPalette tests Update createMuiTheme tests Bump package size
@mbrookes Yeah 🎉 ! Good job 👯♂️ |
I love you guys ❤️ |
@yuchi Half the value comes from you raising the issue and convincing us to do the change 💯 . |
Closes #8075
Closes #8183
Still outstanding:
Two uses of primary accent colors (currently converted to primary.dark / light)(ok as is)
Enhanced dark / light method?(Not needed)
(Although personally I like orange better with our current blue primary!)
Breaking change
It's an important simplification of the palette system. You can now directly use the “official” Color Tool.
light
,main
,dark
andcontrastText
.main
value.