-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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 primary
, secondary
and error
theme palette
#26555
Changes from 11 commits
c4769db
cc49082
67ad326
ab584bc
576fc04
56c106d
0c90ea0
7b279ab
4057597
0fbddad
8916d2c
d723254
ffa7c77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { expect } from 'chai'; | ||
import { deepOrange, indigo, pink } from '../colors'; | ||
import { deepOrange, blue, purple, indigo } from '../colors'; | ||
import { darken, lighten } from './colorManipulator'; | ||
import createPalette, { dark, light } from './createPalette'; | ||
|
||
|
@@ -85,11 +85,11 @@ describe('createPalette()', () => { | |
|
||
it('should create a dark palette', () => { | ||
const palette = createPalette({ mode: 'dark' }); | ||
expect(palette.primary.main, 'should use indigo as the default primary color').to.equal( | ||
indigo[500], | ||
expect(palette.primary.main, 'should use blue as the default primary color').to.equal( | ||
blue[200], | ||
); | ||
expect(palette.secondary.main, 'should use pink as the default secondary color').to.equal( | ||
pink.A400, | ||
expect(palette.secondary.main, 'should use purple as the default secondary color').to.equal( | ||
purple[200], | ||
); | ||
expect(palette.text, 'should use dark theme text').to.equal(dark.text); | ||
}); | ||
|
@@ -176,8 +176,9 @@ describe('createPalette()', () => { | |
contrastThreshold: 0, | ||
})); | ||
}).toErrorDev([ | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // warning palette | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // info palette | ||
'falls below the WCAG recommended absolute minimum contrast ratio of 3:1', // success palette | ||
Comment on lines
+179
to
+181
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we include the color in the warning? If not then we can follow-up. Otherwise I'd make sure the color is included in the assertion which means we can get rid of the (potentially wrong) code comments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 lines was there at the beginning (1 more is added because |
||
]); | ||
|
||
expect(() => { | ||
|
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.
use
defaultTheme
here to remove hard coded color in the test below.I wonder should
defaultTheme
be exported asdefaultLightTheme
from@material-ui/core/styles
also?In my side project I use
defaultTheme
a lot and it is quite annoying to callcreateTheme()
everytime.