/
_datepicker-theme.scss
134 lines (107 loc) · 3.69 KB
/
_datepicker-theme.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/typography/typography-utils';
$mat-datepicker-selected-today-box-shadow-width: 1px;
$mat-datepicker-selected-fade-amount: 0.6;
$mat-datepicker-today-fade-amount: 0.2;
$mat-calendar-body-font-size: 13px !default;
$mat-calendar-weekday-table-font-size: 11px !default;
@mixin _mat-datepicker-color($palette) {
.mat-calendar-body-selected {
background-color: mat-color($palette);
color: mat-color($palette, default-contrast);
}
.mat-calendar-body-disabled > .mat-calendar-body-selected {
background-color: fade-out(mat-color($palette), $mat-datepicker-selected-fade-amount);
}
.mat-calendar-body-today.mat-calendar-body-selected {
box-shadow: inset 0 0 0 $mat-datepicker-selected-today-box-shadow-width
mat-color($palette, default-contrast);
}
}
@mixin mat-datepicker-theme($theme) {
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);
.mat-calendar-arrow {
border-top-color: mat-color($foreground, icon);
}
// The prev/next buttons need a bit more specificity to
// avoid being overwritten by the .mat-icon-button.
.mat-datepicker-toggle,
.mat-datepicker-popup .mat-calendar-next-button,
.mat-datepicker-popup .mat-calendar-previous-button {
color: mat-color($foreground, icon);
}
.mat-calendar-table-header {
color: mat-color($foreground, hint-text);
}
.mat-calendar-table-header-divider::after {
background: mat-color($foreground, divider);
}
.mat-calendar-body-label {
color: mat-color($foreground, secondary-text);
}
.mat-calendar-body-cell-content {
color: mat-color($foreground, text);
border-color: transparent;
}
.mat-calendar-body-disabled > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected) {
color: mat-color($foreground, disabled-text);
}
.mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover,
.cdk-keyboard-focused .mat-calendar-body-active,
.cdk-program-focused .mat-calendar-body-active {
& > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected) {
background-color: mat-color($background, hover);
}
}
.mat-calendar-body-today:not(.mat-calendar-body-selected) {
// Note: though it's not text, the border is a hint about the fact that this is today's date,
// so we use the hint color.
border-color: mat-color($foreground, hint-text);
}
.mat-calendar-body-disabled > .mat-calendar-body-today:not(.mat-calendar-body-selected) {
border-color: fade-out(mat-color($foreground, hint-text), $mat-datepicker-today-fade-amount);
}
@include _mat-datepicker-color(map-get($theme, primary));
.mat-datepicker-content {
background-color: mat-color($background, card);
color: mat-color($foreground, text);
&.mat-accent {
@include _mat-datepicker-color(map-get($theme, accent));
}
&.mat-warn {
@include _mat-datepicker-color(map-get($theme, warn));
}
}
.mat-datepicker-toggle-active {
color: mat-color(map-get($theme, primary));
&.mat-accent {
color: mat-color(map-get($theme, accent));
}
&.mat-warn {
color: mat-color(map-get($theme, warn));
}
}
}
@mixin mat-datepicker-typography($config) {
.mat-calendar {
font-family: mat-font-family($config);
}
.mat-calendar-body {
font-size: $mat-calendar-body-font-size;
}
.mat-calendar-body-label,
.mat-calendar-period-button {
font: {
size: mat-font-size($config, button);
weight: mat-font-weight($config, button);
}
}
.mat-calendar-table-header th {
font: {
size: $mat-calendar-weekday-table-font-size;
weight: mat-font-weight($config, body-1);
}
}
}