Skip to content

Commit 15038e3

Browse files
benelliottjosephperrott
authored andcommitted
feat(style): allow palettes to specify a separate hue for colored text (#15149)
Fixes #15148
1 parent aadfc88 commit 15038e3

File tree

10 files changed

+28
-27
lines changed

10 files changed

+28
-27
lines changed

Diff for: src/material/button/_button-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ $_mat-button-ripple-opacity: 0.1;
8686
color: inherit;
8787
background: transparent;
8888

89-
@include _mat-button-theme-property($theme, 'color', default);
89+
@include _mat-button-theme-property($theme, 'color', text);
9090
@include _mat-button-focus-overlay-color($theme);
9191

9292
// Setup the ripple color to be based on the text color. This ensures that the ripples

Diff for: src/material/core/option/_option-theme.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
}
3434

3535
.mat-primary .mat-option.mat-selected:not(.mat-option-disabled) {
36-
color: mat-color($primary);
36+
color: mat-color($primary, text);
3737
}
3838

3939
.mat-accent .mat-option.mat-selected:not(.mat-option-disabled) {
40-
color: mat-color($accent);
40+
color: mat-color($accent, text);
4141
}
4242

4343
.mat-warn .mat-option.mat-selected:not(.mat-option-disabled) {
44-
color: mat-color($warn);
44+
color: mat-color($warn, text);
4545
}
4646
}
4747

Diff for: src/material/core/theming/_theming.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
// @param $color-map
1515
// @param $primary
1616
// @param $lighter
17-
@function mat-palette($base-palette, $default: 500, $lighter: 100, $darker: 700) {
17+
@function mat-palette($base-palette, $default: 500, $lighter: 100, $darker: 700, $text: $default) {
1818
$result: map_merge($base-palette, (
1919
default: map-get($base-palette, $default),
2020
lighter: map-get($base-palette, $lighter),
2121
darker: map-get($base-palette, $darker),
22+
text: map-get($base-palette, $text),
2223

2324
default-contrast: mat-contrast($base-palette, $default),
2425
lighter-contrast: mat-contrast($base-palette, $lighter),

Diff for: src/material/datepicker/_datepicker-theme.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ $mat-calendar-weekday-table-font-size: 11px !default;
122122
}
123123

124124
.mat-datepicker-toggle-active {
125-
color: mat-color(map-get($theme, primary));
125+
color: mat-color(map-get($theme, primary), text);
126126

127127
&.mat-accent {
128-
color: mat-color(map-get($theme, accent));
128+
color: mat-color(map-get($theme, accent), text);
129129
}
130130

131131
&.mat-warn {
132-
color: mat-color(map-get($theme, warn));
132+
color: mat-color(map-get($theme, warn), text);
133133
}
134134
}
135135
}

Diff for: src/material/form-field/_form-field-theme.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
// Label colors. Required is used for the `*` star shown in the label.
2121
$label-color: mat-color($foreground, secondary-text, if($is-dark-theme, 0.7, 0.6));
22-
$focused-label-color: mat-color($primary);
23-
$required-label-color: mat-color($accent);
22+
$focused-label-color: mat-color($primary, text);
23+
$required-label-color: mat-color($accent, text);
2424

2525
// Underline colors.
2626
$underline-color-base: mat-color($foreground, divider, if($is-dark-theme, 1, 0.87));
27-
$underline-color-accent: mat-color($accent);
28-
$underline-color-warn: mat-color($warn);
29-
$underline-focused-color: mat-color($primary);
27+
$underline-color-accent: mat-color($accent, text);
28+
$underline-color-warn: mat-color($warn, text);
29+
$underline-focused-color: mat-color($primary, text);
3030

3131
.mat-form-field-label {
3232
color: $label-color;

Diff for: src/material/icon/_icon-theme.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
.mat-icon {
1313
&.mat-primary {
14-
color: mat-color($primary);
14+
color: mat-color($primary, text);
1515
}
1616

1717
&.mat-accent {
18-
color: mat-color($accent);
18+
color: mat-color($accent, text);
1919
}
2020

2121
&.mat-warn {
22-
color: mat-color($warn);
22+
color: mat-color($warn, text);
2323
}
2424
}
2525
}

Diff for: src/material/input/_input-theme.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222

2323
.mat-input-element {
24-
caret-color: mat-color($primary);
24+
caret-color: mat-color($primary, text);
2525

2626
@include input-placeholder {
2727
color: _mat-control-placeholder-color($theme);
@@ -44,16 +44,16 @@
4444
}
4545

4646
.mat-accent .mat-input-element {
47-
caret-color: mat-color($accent);
47+
caret-color: mat-color($accent, text);
4848
}
4949

5050
.mat-warn .mat-input-element,
5151
.mat-form-field-invalid .mat-input-element {
52-
caret-color: mat-color($warn);
52+
caret-color: mat-color($warn, text);
5353
}
5454

5555
.mat-form-field-type-mat-native-select.mat-form-field-invalid .mat-form-field-infix::after {
56-
color: mat-color($warn);
56+
color: mat-color($warn, text);
5757
}
5858
}
5959

Diff for: src/material/select/_select-theme.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@
4040
.mat-form-field {
4141
&.mat-focused {
4242
&.mat-primary .mat-select-arrow {
43-
color: mat-color($primary);
43+
color: mat-color($primary, text);
4444
}
4545

4646
&.mat-accent .mat-select-arrow {
47-
color: mat-color($accent);
47+
color: mat-color($accent, text);
4848
}
4949

5050
&.mat-warn .mat-select-arrow {
51-
color: mat-color($warn);
51+
color: mat-color($warn, text);
5252
}
5353
}
5454

5555
.mat-select.mat-select-invalid .mat-select-arrow {
56-
color: mat-color($warn);
56+
color: mat-color($warn, text);
5757
}
5858

5959
.mat-select.mat-select-disabled .mat-select-arrow {

Diff for: src/material/snack-bar/_snack-bar-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717

1818
.mat-simple-snackbar-action {
19-
color: if($is-dark-theme, inherit, mat-color($accent));
19+
color: if($is-dark-theme, inherit, mat-color($accent, text));
2020
}
2121
}
2222

Diff for: src/material/stepper/_stepper-theme.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747

4848
.mat-step-icon-state-error {
4949
background-color: transparent;
50-
color: mat-color($warn);
50+
color: mat-color($warn, text);
5151
}
5252

5353
.mat-step-label.mat-step-label-active {
5454
color: mat-color($foreground, text);
5555
}
5656

5757
.mat-step-label.mat-step-label-error {
58-
color: mat-color($warn);
58+
color: mat-color($warn, text);
5959
}
6060
}
6161

0 commit comments

Comments
 (0)