Skip to content

Commit ecc53d6

Browse files
andrewseguinAndrew Seguin
and
Andrew Seguin
authored
refactor: converge remaining secondary text to on-surface-variant (#31268)
Co-authored-by: Andrew Seguin <[email protected]>
1 parent 8b821cb commit ecc53d6

File tree

8 files changed

+17
-36
lines changed

8 files changed

+17
-36
lines changed

src/material/checkbox/_m2-checkbox.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
$palette-default: inspection.get-theme-color($theme, $palette-name, default);
3030
$disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
3131
$palette-selected: inspection.get-theme-color($theme, $palette-name);
32-
$border-color: inspection.get-theme-color($theme, foreground, base, 0.54);
3332
$selected-checkmark-color:
3433
inspection.get-theme-color($theme, $palette-name, default-contrast);
3534

@@ -45,7 +44,7 @@
4544
checkbox-selected-pressed-icon-color: $palette-selected,
4645
checkbox-unselected-focus-icon-color: map.get($system, on-surface),
4746
checkbox-unselected-hover-icon-color: map.get($system, on-surface),
48-
checkbox-unselected-icon-color: $border-color,
47+
checkbox-unselected-icon-color: map.get($system, on-surface-variant),
4948
checkbox-selected-focus-state-layer-color: $palette-default,
5049
checkbox-selected-hover-state-layer-color: $palette-default,
5150
checkbox-selected-pressed-state-layer-color: $palette-default,

src/material/core/theming/tests/theming-mixin-api.spec.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,6 @@ describe('theming api', () => {
7979
expectNoWarning(/The same color styles are generated multiple times/);
8080
});
8181

82-
it('should be possible to modify color configuration directly', () => {
83-
const result = transpile(`
84-
$theme: mat.m2-define-light-theme((
85-
color: (
86-
primary: mat.m2-define-palette(mat.$m2-red-palette),
87-
accent: mat.m2-define-palette(mat.$m2-blue-palette),
88-
)
89-
));
90-
91-
// Updates the "icon" foreground color to hotpink.
92-
$color: map-get($theme, color);
93-
$theme: map-merge($color,
94-
(foreground: map-merge(map-get($color, foreground), (icon: hotpink))));
95-
96-
@include mat.all-component-themes($theme);
97-
`);
98-
99-
expect(result).toContain(': hotpink');
100-
});
101-
10282
it('should warn if default density styles are duplicated', () => {
10383
spyOn(process.stderr, 'write');
10484

src/material/datepicker/_m2-datepicker.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ $private-default-overlap-color: #a8dab5;
7070
}
7171

7272
@return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
73-
datepicker-toggle-icon-color: $inactive-icon-color,
73+
datepicker-toggle-icon-color: map.get($system, on-surface-variant),
7474
datepicker-calendar-body-label-text-color: map.get($system, on-surface-variant),
7575
datepicker-calendar-period-button-text-color:
7676
inspection.get-theme-color($theme, foreground, base),
77-
datepicker-calendar-period-button-icon-color: $inactive-icon-color,
78-
datepicker-calendar-navigation-button-icon-color: $inactive-icon-color,
77+
datepicker-calendar-period-button-icon-color: map.get($system, on-surface-variant),
78+
datepicker-calendar-navigation-button-icon-color: map.get($system, on-surface-variant),
7979
datepicker-calendar-header-divider-color: map.get($system, outline),
8080
datepicker-calendar-header-text-color: map.get($system, on-surface-variant),
8181

src/material/dialog/_m2-dialog.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@return (
2828
dialog-container-color: inspection.get-theme-color($theme, system, surface),
2929
dialog-subhead-color: inspection.get-theme-color($theme, system, on-surface),
30-
dialog-supporting-text-color: inspection.get-theme-color($theme, foreground, base, 0.6),
30+
dialog-supporting-text-color: inspection.get-theme-color($theme, system, on-surface-variant),
3131
);
3232
}
3333

src/material/list/_m2-list.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
list-list-item-label-text-color: map.get($system, on-surface),
3737
list-list-item-supporting-text-color: map.get($system, on-surface-variant),
3838
list-list-item-leading-icon-color: $text-icon-on-background,
39-
list-list-item-trailing-supporting-text-color:
40-
inspection.get-theme-color($theme, foreground, hint-text),
39+
list-list-item-trailing-supporting-text-color: map.get($system, on-surface-variant),
4140
list-list-item-trailing-icon-color: $text-icon-on-background,
4241
list-list-item-selected-trailing-icon-color: $text-icon-on-background,
4342
list-list-item-disabled-label-text-color: map.get($system, on-surface),

src/material/paginator/_m2-paginator.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@use 'sass:map';
33
@use '../core/theming/theming';
44
@use '../core/theming/inspection';
5+
@use '../core/tokens/m2-utils';
56

67
// Tokens that can't be configured through Angular Material's current theming API,
78
// but may be in a future version of the theming API.
@@ -11,10 +12,12 @@
1112

1213
// Tokens that can be configured through Angular Material's color theming API.
1314
@function get-color-tokens($theme) {
15+
$system: m2-utils.get-system($theme);
16+
1417
@return (
15-
paginator-container-text-color: inspection.get-theme-color($theme, system, on-surface),
16-
paginator-container-background-color: inspection.get-theme-color($theme, system, surface),
17-
paginator-enabled-icon-color: inspection.get-theme-color($theme, foreground, base, 0.54),
18+
paginator-container-text-color: map.get($system, on-surface),
19+
paginator-container-background-color: map.get($system, surface),
20+
paginator-enabled-icon-color: map.get($system, on-surface-variant),
1821
paginator-disabled-icon-color: inspection.get-theme-color($theme, foreground, base, 0.12),
1922
);
2023
}

src/material/radio/_m2-radio.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
radio-selected-pressed-icon-color: $palette-color,
3838
radio-unselected-focus-icon-color: map.get($system, on-surface),
3939
radio-unselected-hover-icon-color: map.get($system, on-surface),
40-
radio-unselected-icon-color: inspection.get-theme-color($theme, foreground, base, 0.54),
40+
radio-unselected-icon-color: map.get($system, on-surface-variant),
4141
radio-unselected-pressed-icon-color: map.get($system, on-surface),
4242
);
4343
}

src/material/select/_m2-select.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
$disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
2020

2121
@return (
22-
select-panel-background-color: inspection.get-theme-color($theme, system, surface),
23-
select-enabled-trigger-text-color: inspection.get-theme-color($theme, system, on-surface),
22+
select-panel-background-color: map.get($system, surface),
23+
select-enabled-trigger-text-color: map.get($system, on-surface),
2424
select-disabled-trigger-text-color: $disabled,
25-
select-placeholder-text-color: inspection.get-theme-color($theme, foreground, base, 0.6),
26-
select-enabled-arrow-color: inspection.get-theme-color($theme, foreground, base, 0.54),
25+
select-placeholder-text-color: map.get($system, on-surface-variant),
26+
select-enabled-arrow-color: map.get($system, on-surface-variant),
2727
select-disabled-arrow-color: $disabled,
2828
select-focused-arrow-color: inspection.get-theme-color($theme, $palette-name, default, 0.87),
2929
select-invalid-arrow-color: inspection.get-theme-color($theme, warn, default, 0.87),

0 commit comments

Comments
 (0)