-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(datepicker): calendar panel theme supports dark mode #11201
fix(datepicker): calendar panel theme supports dark mode #11201
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
Thank you for your contribution! Update the commit message to include |
f034a52
to
0e927f1
Compare
ok commit message fixed.
but any value rgba with alpha less than 1: that's why i did not change it |
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.
Please address the changes to light mode (which ideally should be kept the same, or only very slightly modified if the modification is specified by the spec).
https://material.io/guidelines/components/pickers.html#pickers-date-pickers also in Why in |
0e927f1
to
808b22f
Compare
ok i pushed fix Also i changed separeted lines tr:last-child td {
border-bottom-color: '{{background-hue-2}}';
} but still in my opinion we should change background color of months header to the calendar background color. There should be no differences between these background colors. But we can open another issue for that |
Yes, I think that months header change should be part of a separate issue/PR so that we don't put these changes at additional risk. Thanks for updating. I'll do some manually testing on this soon. |
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.
Thank you for putting this together. There appear to be some small differences in light mode themes which I've made notes about.
@@ -28,7 +28,7 @@ | |||
.md-calendar-date-selection-indicator { | |||
.md-calendar-date.md-focus &, | |||
&:hover { | |||
background: '{{background-300}}'; | |||
background: '{{background-500-0.33}}'; |
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.
This seems very slightly off in Light mode.
master
=>rgb(224, 224, 224)
.- This branch =>
rgba(158, 158, 158, 0.33)
which converts torgb(223, 223, 223)
.
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.
'{{background-500-0.32}}'
its better => rgb(224, 224, 224)
} | ||
} | ||
.md-THEME_NAME-theme { | ||
.md-calendar-day-header { | ||
background: '{{background-300}}'; | ||
color: '{{background-A200-0.87}}'; | ||
background: '{{background-500-0.33}}'; |
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.
Same as below with being just slightly different than master
in light mode.
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.
should be'{{background-500-0.32}}'
|
||
tr:last-child td { | ||
border-bottom-color: '{{background-200}}'; | ||
border-bottom-color: '{{background-hue-2}}'; |
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.
Light mode:
master
=>rgb(238, 238, 238)
- updates =>
rgb(245, 245, 245)
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 can't find proper value with alpha channel === 1.0
which looks good in dark mode and also looks the same as master
build. Using alpha channel less than 1.0
makes render glitches.
I think '{{background-hue-2}}'
is a reasonable compromise. We have very small difference in light mode whitch doesnt' affect on UX and also good dark theme mode.
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.
OK, we can try to presubmit it using that value and see if it gets through.
background: '{{background-A100}}'; | ||
color: '{{background-A200-0.87}}'; | ||
background: '{{background-hue-1}}'; | ||
color: '{{foreground-1}}'; |
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.
Can you please add a simple md-calendar
demo?
We have the directive docs but there is no demo for using the md-calendar
directly w/o an md-datepicker
.
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.
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.
md-datepicker
doesn't seem to apply themd-calendar
class at all.
not exactly. Simple test shows something different:
.md-calendar.md-THEME_NAME-theme {
background: red;
}
after that whole overlapping panel has red background. So md-datepicker
apply .md-calendar
class to panel
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.
Interesting. I wasn't able to find the class in the DOM, but I'll take your word for it.
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.
Oh I found it now. Strange that Chrome DevTools search didn't work...
808b22f
to
1698fb9
Compare
@@ -28,7 +28,7 @@ | |||
.md-calendar-date-selection-indicator { | |||
.md-calendar-date.md-focus &, | |||
&:hover { | |||
background: '{{background-300}}'; | |||
background: '{{background-500-0.32}}'; | |||
} | |||
} | |||
|
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.
The comments on Lines 47-50 need to be updated as they are no longer accurate. Perhaps just removing ", even on the dark theme," is enough.
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.
.md-calendar-date-disabled,
.md-calendar-month-label-disabled {
I think that we need to update the disabled date/month colors too.
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.
You have right https://material.angularjs.org/latest/demo/datepicker
example Only weekends are selectable
i will fix it
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.
what do You think about
.md-calendar-date-disabled,
.md-calendar-month-label-disabled {
color: '{{foreground-3}}';
}
its a litle bit brighter than background-A200-0.435
in light mode.
But in both modes light/dark looks great.
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.
Sounds good. There is a comment in theming.js
:
* {{foreground-3}} - used for disabled text
.
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.
fix was pushed
1698fb9
to
b8ffb2a
Compare
OK, yeah, changing the theme works best 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.
LGTM
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The datepicker calendar panel is always using light mode hues even when the theme is dark mode.
Issue Number:
#11200
What is the new behavior?
The datepicker calendar panel use dark mode hues when the theme is set to dark mode.
Does this PR introduce a breaking change?
Other information
Before dark mode:
After dark mode:
After light mode: