Skip to content

refactor: converge remaining secondary text to on-surface-variant #31268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/material/checkbox/_m2-checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
$palette-default: inspection.get-theme-color($theme, $palette-name, default);
$disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
$palette-selected: inspection.get-theme-color($theme, $palette-name);
$border-color: inspection.get-theme-color($theme, foreground, base, 0.54);
$selected-checkmark-color:
inspection.get-theme-color($theme, $palette-name, default-contrast);

Expand All @@ -45,7 +44,7 @@
checkbox-selected-pressed-icon-color: $palette-selected,
checkbox-unselected-focus-icon-color: map.get($system, on-surface),
checkbox-unselected-hover-icon-color: map.get($system, on-surface),
checkbox-unselected-icon-color: $border-color,
checkbox-unselected-icon-color: map.get($system, on-surface-variant),
checkbox-selected-focus-state-layer-color: $palette-default,
checkbox-selected-hover-state-layer-color: $palette-default,
checkbox-selected-pressed-state-layer-color: $palette-default,
Expand Down
20 changes: 0 additions & 20 deletions src/material/core/theming/tests/theming-mixin-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,6 @@ describe('theming api', () => {
expectNoWarning(/The same color styles are generated multiple times/);
});

it('should be possible to modify color configuration directly', () => {
const result = transpile(`
$theme: mat.m2-define-light-theme((
color: (
primary: mat.m2-define-palette(mat.$m2-red-palette),
accent: mat.m2-define-palette(mat.$m2-blue-palette),
)
));

// Updates the "icon" foreground color to hotpink.
$color: map-get($theme, color);
$theme: map-merge($color,
(foreground: map-merge(map-get($color, foreground), (icon: hotpink))));

@include mat.all-component-themes($theme);
`);

expect(result).toContain(': hotpink');
});

it('should warn if default density styles are duplicated', () => {
spyOn(process.stderr, 'write');

Expand Down
6 changes: 3 additions & 3 deletions src/material/datepicker/_m2-datepicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ $private-default-overlap-color: #a8dab5;
}

@return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
datepicker-toggle-icon-color: $inactive-icon-color,
datepicker-toggle-icon-color: map.get($system, on-surface-variant),
datepicker-calendar-body-label-text-color: map.get($system, on-surface-variant),
datepicker-calendar-period-button-text-color:
inspection.get-theme-color($theme, foreground, base),
datepicker-calendar-period-button-icon-color: $inactive-icon-color,
datepicker-calendar-navigation-button-icon-color: $inactive-icon-color,
datepicker-calendar-period-button-icon-color: map.get($system, on-surface-variant),
datepicker-calendar-navigation-button-icon-color: map.get($system, on-surface-variant),
datepicker-calendar-header-divider-color: map.get($system, outline),
datepicker-calendar-header-text-color: map.get($system, on-surface-variant),

Expand Down
2 changes: 1 addition & 1 deletion src/material/dialog/_m2-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@return (
dialog-container-color: inspection.get-theme-color($theme, system, surface),
dialog-subhead-color: inspection.get-theme-color($theme, system, on-surface),
dialog-supporting-text-color: inspection.get-theme-color($theme, foreground, base, 0.6),
dialog-supporting-text-color: inspection.get-theme-color($theme, system, on-surface-variant),
);
}

Expand Down
3 changes: 1 addition & 2 deletions src/material/list/_m2-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
list-list-item-label-text-color: map.get($system, on-surface),
list-list-item-supporting-text-color: map.get($system, on-surface-variant),
list-list-item-leading-icon-color: $text-icon-on-background,
list-list-item-trailing-supporting-text-color:
inspection.get-theme-color($theme, foreground, hint-text),
list-list-item-trailing-supporting-text-color: map.get($system, on-surface-variant),
list-list-item-trailing-icon-color: $text-icon-on-background,
list-list-item-selected-trailing-icon-color: $text-icon-on-background,
list-list-item-disabled-label-text-color: map.get($system, on-surface),
Expand Down
9 changes: 6 additions & 3 deletions src/material/paginator/_m2-paginator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@use 'sass:map';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/tokens/m2-utils';

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

// Tokens that can be configured through Angular Material's color theming API.
@function get-color-tokens($theme) {
$system: m2-utils.get-system($theme);

@return (
paginator-container-text-color: inspection.get-theme-color($theme, system, on-surface),
paginator-container-background-color: inspection.get-theme-color($theme, system, surface),
paginator-enabled-icon-color: inspection.get-theme-color($theme, foreground, base, 0.54),
paginator-container-text-color: map.get($system, on-surface),
paginator-container-background-color: map.get($system, surface),
paginator-enabled-icon-color: map.get($system, on-surface-variant),
paginator-disabled-icon-color: inspection.get-theme-color($theme, foreground, base, 0.12),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/material/radio/_m2-radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
radio-selected-pressed-icon-color: $palette-color,
radio-unselected-focus-icon-color: map.get($system, on-surface),
radio-unselected-hover-icon-color: map.get($system, on-surface),
radio-unselected-icon-color: inspection.get-theme-color($theme, foreground, base, 0.54),
radio-unselected-icon-color: map.get($system, on-surface-variant),
radio-unselected-pressed-icon-color: map.get($system, on-surface),
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/material/select/_m2-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
$disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);

@return (
select-panel-background-color: inspection.get-theme-color($theme, system, surface),
select-enabled-trigger-text-color: inspection.get-theme-color($theme, system, on-surface),
select-panel-background-color: map.get($system, surface),
select-enabled-trigger-text-color: map.get($system, on-surface),
select-disabled-trigger-text-color: $disabled,
select-placeholder-text-color: inspection.get-theme-color($theme, foreground, base, 0.6),
select-enabled-arrow-color: inspection.get-theme-color($theme, foreground, base, 0.54),
select-placeholder-text-color: map.get($system, on-surface-variant),
select-enabled-arrow-color: map.get($system, on-surface-variant),
select-disabled-arrow-color: $disabled,
select-focused-arrow-color: inspection.get-theme-color($theme, $palette-name, default, 0.87),
select-invalid-arrow-color: inspection.get-theme-color($theme, warn, default, 0.87),
Expand Down
Loading