Skip to content

refactor: switch m2 from palette divider to system outline #31200

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
May 23, 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@use '@angular/material' as mat;

@mixin color($theme) {
$non-resizable-hover-divider: mat.get-theme-color($theme, foreground, divider);
$resizable-hover-divider: mat.get-theme-color($theme, primary, 600);
$resizable-active-divider: mat.get-theme-color($theme, primary, 600);

Expand Down Expand Up @@ -65,15 +64,15 @@

.mat-header-cell:not(.mat-resizable)::after,
.mat-mdc-header-cell:not(.mat-resizable)::after {
background: $non-resizable-hover-divider;
background: mat.get-theme-color($theme, system, outline);
}

.mat-resizable-handle {
background: $resizable-hover-divider;
}

.cdk-resizable-resize-disabled > .mat-resizable-handle {
background: $non-resizable-hover-divider;
background: mat.get-theme-color($theme, system, outline);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/button-toggle/_m2-button-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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

// By default the theme usually has an rgba color for the dividers, which can
// stack up with the background of a button toggle. This can cause the border
Expand Down
2 changes: 1 addition & 1 deletion src/material/button/_m2-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
// internally. For now we fall back to the old hardcoded behavior only for internal apps.
$outline: if(m2-utils.$private-is-internal-build,
rgba(if($is-dark, #fff, #000), 0.12),
inspection.get-theme-color($theme, foreground, divider)
inspection.get-theme-color($theme, system, outline)
);

@return (
Expand Down
2 changes: 2 additions & 0 deletions src/material/core/m2/_theming.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
system: (
surface: white,
on-surface: rgba(black, 0.87),
outline: rgba(black, 0.12),
),
);
}
Expand All @@ -141,6 +142,7 @@
system: (
surface: map.get(palette.$grey-palette, 800),
on-surface: white,
outline: rgba(white, 0.12),
),
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/material/datepicker/_m2-datepicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ $private-default-overlap-color: #a8dab5;
$text-color: inspection.get-theme-color($theme, system, on-surface);
$secondary-text-color: inspection.get-theme-color($theme, foreground, secondary-text);
$disabled-text-color: inspection.get-theme-color($theme, foreground, disabled-text);
$divider-color: inspection.get-theme-color($theme, foreground, divider);
$hint-text-color: inspection.get-theme-color($theme, foreground, hint-text);
$preview-outline-color: $divider-color;
$preview-outline-color: inspection.get-theme-color($theme, system, outline);
$today-disabled-outline-color: null;
$is-dark: inspection.get-theme-type($theme) == dark;

Expand Down Expand Up @@ -74,7 +73,7 @@ $private-default-overlap-color: #a8dab5;
inspection.get-theme-color($theme, foreground, text, 1),
datepicker-calendar-period-button-icon-color: $inactive-icon-color,
datepicker-calendar-navigation-button-icon-color: $inactive-icon-color,
datepicker-calendar-header-divider-color: $divider-color,
datepicker-calendar-header-divider-color: inspection.get-theme-color($theme, system, outline),
datepicker-calendar-header-text-color: $secondary-text-color,

// Note: though it's not text, the border is a hint about the fact
Expand Down
2 changes: 1 addition & 1 deletion src/material/divider/_m2-divider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Tokens that can be configured through Angular Material's color theming API.
@function get-color-tokens($theme) {
@return (
divider-color: inspection.get-theme-color($theme, foreground, divider)
divider-color: inspection.get-theme-color($theme, system, outline)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/expansion/_m2-expansion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@return (
expansion-container-background-color: inspection.get-theme-color($theme, system, surface),
expansion-container-text-color: inspection.get-theme-color($theme, system, on-surface),
expansion-actions-divider-color: inspection.get-theme-color($theme, foreground, divider),
expansion-actions-divider-color: inspection.get-theme-color($theme, system, outline),
expansion-header-hover-state-layer-color: inspection.get-theme-color($theme, background, hover),
expansion-header-focus-state-layer-color: inspection.get-theme-color($theme, background, hover),
expansion-header-disabled-state-text-color: inspection.get-theme-color(
Expand Down
2 changes: 1 addition & 1 deletion src/material/form-field/_m2-form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
$disabled-text-color-base: if(m2-utils.$private-is-internal-build, $on-surface,
inspection.get-theme-color($theme, foreground, disabled-text, 1));
$divider-base: if(m2-utils.$private-is-internal-build, $on-surface,
inspection.get-theme-color($theme, foreground, divider, 1));
inspection.get-theme-color($theme, foreground, base));

@return map.merge($color-tokens, (
// MDC has a token for the enabled placeholder, but not for the disabled one.
Expand Down
2 changes: 1 addition & 1 deletion src/material/menu/_m2-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
menu-item-hover-state-layer-color: $active-state-layer-color,
menu-item-focus-state-layer-color: $active-state-layer-color,
menu-container-color: inspection.get-theme-color($theme, system, surface),
menu-divider-color: inspection.get-theme-color($theme, foreground, divider),
menu-divider-color: inspection.get-theme-color($theme, system, outline),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/select/_m2-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$disabled-text-color-base: if(m2-utils.$private-is-internal-build, $on-surface,
inspection.get-theme-color($theme, foreground, disabled-text, 1));
$icon-color-base: if(m2-utils.$private-is-internal-build, $on-surface,
inspection.get-theme-color($theme, foreground, divider, 1));
inspection.get-theme-color($theme, foreground, base));

@return (
select-panel-background-color: inspection.get-theme-color($theme, system, surface),
Expand Down
2 changes: 1 addition & 1 deletion src/material/sidenav/_m2-sidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));

@return (
sidenav-container-divider-color: inspection.get-theme-color($theme, foreground, divider),
sidenav-container-divider-color: inspection.get-theme-color($theme, system, outline),
sidenav-container-background-color: inspection.get-theme-color($theme, system, surface),
sidenav-container-text-color: inspection.get-theme-color($theme, system, on-surface),
sidenav-content-background-color: inspection.get-theme-color($theme, background, background),
Expand Down
2 changes: 1 addition & 1 deletion src/material/stepper/_m2-stepper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@function get-color-tokens($theme) {
@return map.merge(private-get-color-palette-color-tokens($theme, primary), (
stepper-container-color: inspection.get-theme-color($theme, system, surface),
stepper-line-color: inspection.get-theme-color($theme, foreground, divider),
stepper-line-color: inspection.get-theme-color($theme, system, outline),
stepper-header-hover-state-layer-color: inspection.get-theme-color($theme, background, hover),
stepper-header-focus-state-layer-color: inspection.get-theme-color($theme, background, hover),
stepper-header-label-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
Expand Down
2 changes: 1 addition & 1 deletion src/material/table/_m2-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

table-header-headline-color: inspection.get-theme-color($theme, system, on-surface),
table-row-item-label-text-color: inspection.get-theme-color($theme, system, on-surface),
table-row-item-outline-color: inspection.get-theme-color($theme, foreground, divider),
table-row-item-outline-color: inspection.get-theme-color($theme, system, outline),
);
}

Expand Down
Loading