@@ -40,10 +40,18 @@ $mat-calendar-weekday-table-font-size: 11px !default;
40
40
}
41
41
}
42
42
43
+ // Utility mixin to target cells that aren't selected. Used to make selector easier to follow.
44
+ @mixin _mat-datepicker-unselected-cell {
45
+ & :not (.mat-calendar-body-selected ):not (.mat-calendar-body-comparison-identical ) {
46
+ @content ;
47
+ }
48
+ }
49
+
43
50
@mixin mat-datepicker-color ($config-or-theme ) {
44
51
$config : mat-get-color-config ($config-or-theme );
45
52
$foreground : map-get ($config , foreground );
46
53
$background : map-get ($config , background );
54
+ $disabled-color : mat-color ($foreground , disabled-text );
47
55
48
56
.mat-calendar-arrow {
49
57
border-top-color : mat-color ($foreground , icon );
@@ -75,16 +83,23 @@ $mat-calendar-weekday-table-font-size: 11px !default;
75
83
border-color : transparent ;
76
84
}
77
85
78
- .mat-calendar-body-disabled > .mat-calendar-body-cell-content :not (.mat-calendar-body-selected ),
86
+ .mat-calendar-body-disabled > .mat-calendar-body-cell-content {
87
+ @include _mat-datepicker-unselected-cell {
88
+ color : $disabled-color ;
89
+ }
90
+ }
91
+
79
92
.mat-form-field-disabled .mat-date-range-input-separator {
80
- color : mat-color ( $foreground , disabled-text ) ;
93
+ color : $ disabled-color ;
81
94
}
82
95
83
96
.mat-calendar-body-cell :not (.mat-calendar-body-disabled ):hover ,
84
97
.cdk-keyboard-focused .mat-calendar-body-active ,
85
98
.cdk-program-focused .mat-calendar-body-active {
86
- & > .mat-calendar-body-cell-content :not (.mat-calendar-body-selected ) {
87
- background-color : mat-color ($background , hover );
99
+ & > .mat-calendar-body-cell-content {
100
+ @include _mat-datepicker-unselected-cell {
101
+ background-color : mat-color ($background , hover );
102
+ }
88
103
}
89
104
}
90
105
@@ -102,24 +117,28 @@ $mat-calendar-weekday-table-font-size: 11px !default;
102
117
}
103
118
}
104
119
105
- .mat-calendar-body-today :not (.mat-calendar-body-selected ) {
106
- // Note: though it's not text, the border is a hint about the fact that this is today's date,
107
- // so we use the hint color.
108
- border-color : mat-color ($foreground , hint-text );
120
+ .mat-calendar-body-today {
121
+ @include _mat-datepicker-unselected-cell {
122
+ // Note: though it's not text, the border is a hint about the fact that this is today's date,
123
+ // so we use the hint color.
124
+ border-color : mat-color ($foreground , hint-text );
125
+ }
109
126
}
110
127
111
- .mat-calendar-body-disabled > .mat-calendar-body-today :not (.mat-calendar-body-selected ) {
112
- $color : mat-color ($foreground , hint-text );
113
-
114
- @if (type-of ($color ) == color ) {
115
- border-color : fade-out ($color , $mat-datepicker-today-fade-amount );
116
- }
117
- @else {
118
- // If the color didn't resolve to a color value, but something like a CSS variable, we can't
119
- // fade it out so we fall back to reducing the element opacity. Note that we don't use the
120
- // $mat-datepicker-today-fade-amount, because hint text usually has some opacity applied
121
- // to it already and we don't want them to stack on top of each other.
122
- opacity : 0.5 ;
128
+ .mat-calendar-body-disabled > .mat-calendar-body-today {
129
+ @include _mat-datepicker-unselected-cell {
130
+ $color : mat-color ($foreground , hint-text );
131
+
132
+ @if (type-of ($color ) == color ) {
133
+ border-color : fade-out ($color , $mat-datepicker-today-fade-amount );
134
+ }
135
+ @else {
136
+ // If the color didn't resolve to a color value, but something like a CSS variable, we can't
137
+ // fade it out so we fall back to reducing the element opacity. Note that we don't use the
138
+ // $mat-datepicker-today-fade-amount, because hint text usually has some opacity applied
139
+ // to it already and we don't want them to stack on top of each other.
140
+ opacity : 0.5 ;
141
+ }
123
142
}
124
143
}
125
144
@@ -196,6 +215,7 @@ $mat-calendar-weekday-table-font-size: 11px !default;
196
215
background : $range-color ;
197
216
}
198
217
218
+ .mat-calendar-body-comparison-identical ,
199
219
.mat-calendar-body-in-comparison-range ::before {
200
220
background : $comparison-color ;
201
221
}
@@ -210,13 +230,14 @@ $mat-calendar-weekday-table-font-size: 11px !default;
210
230
background : linear-gradient (to left , $range-color 50% , $comparison-color 50% );
211
231
}
212
232
233
+ .mat-calendar-body-in-range > .mat-calendar-body-comparison-identical ,
213
234
.mat-calendar-body-in-comparison-range.mat-calendar-body-in-range ::after {
214
235
background : $overlap-color ;
215
236
}
216
237
238
+ .mat-calendar-body-comparison-identical.mat-calendar-body-selected ,
217
239
.mat-calendar-body-in-comparison-range > .mat-calendar-body-selected {
218
240
background : $overlap-selected-color ;
219
-
220
241
}
221
242
}
222
243
0 commit comments