diff --git a/src/material-experimental/column-resize/_column-resize-theme.scss b/src/material-experimental/column-resize/_column-resize-theme.scss index 8d84ca04c912..a135eef41abe 100644 --- a/src/material-experimental/column-resize/_column-resize-theme.scss +++ b/src/material-experimental/column-resize/_column-resize-theme.scss @@ -1,4 +1,5 @@ @use '@angular/material' as mat; +@use 'sass:map'; @mixin color($theme) { $resizable-hover-divider: mat.get-theme-color($theme, primary, 600); @@ -64,7 +65,7 @@ .mat-header-cell:not(.mat-resizable)::after, .mat-mdc-header-cell:not(.mat-resizable)::after { - background: mat.get-theme-color($theme, system, outline); + background: map.get($theme, _mat-system, outline); } .mat-resizable-handle { @@ -72,7 +73,7 @@ } .cdk-resizable-resize-disabled > .mat-resizable-handle { - background: mat.get-theme-color($theme, system, outline); + background: map.get($theme, _mat-system, outline); } } diff --git a/src/material-experimental/popover-edit/_popover-edit-theme.scss b/src/material-experimental/popover-edit/_popover-edit-theme.scss index 578ee868d6bc..cc981d875f8f 100644 --- a/src/material-experimental/popover-edit/_popover-edit-theme.scss +++ b/src/material-experimental/popover-edit/_popover-edit-theme.scss @@ -1,12 +1,13 @@ @use '@angular/cdk'; @use '@angular/material' as mat; +@use 'sass:map'; @function _hover-content-background($direction, $background-color) { @return linear-gradient($direction, rgba($background-color, 0), $background-color 8px); } @mixin color($theme) { - $background-color: mat.get-theme-color($theme, system, surface); + $background-color: map.get($theme, _mat-system, surface); // TODO: these structural styles don't belong in the `color` part of a theme. // We should figure out a better place for them. diff --git a/src/material/autocomplete/_m2-autocomplete.scss b/src/material/autocomplete/_m2-autocomplete.scss index 2753370ab786..5039d9c2d24f 100644 --- a/src/material/autocomplete/_m2-autocomplete.scss +++ b/src/material/autocomplete/_m2-autocomplete.scss @@ -1,5 +1,6 @@ -@use '../core/theming/inspection'; @use '../core/style/elevation'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -12,8 +13,10 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); + @return ( - autocomplete-background-color: inspection.get-theme-color($theme, system, surface) + autocomplete-background-color: map.get($system, surface) ); } diff --git a/src/material/bottom-sheet/_m2-bottom-sheet.scss b/src/material/bottom-sheet/_m2-bottom-sheet.scss index 3b4daf038cc3..0cba0cdc3b6f 100644 --- a/src/material/bottom-sheet/_m2-bottom-sheet.scss +++ b/src/material/bottom-sheet/_m2-bottom-sheet.scss @@ -1,4 +1,6 @@ @use '../core/theming/inspection'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -11,9 +13,11 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); + @return ( - bottom-sheet-container-text-color: inspection.get-theme-color($theme, system, on-surface), - bottom-sheet-container-background-color: inspection.get-theme-color($theme, system, surface), + bottom-sheet-container-text-color: map.get($system, on-surface), + bottom-sheet-container-background-color: map.get($system, surface), ); } diff --git a/src/material/button/_m2-button.scss b/src/material/button/_m2-button.scss index 2feec8aebb02..bd276054d643 100644 --- a/src/material/button/_m2-button.scss +++ b/src/material/button/_m2-button.scss @@ -44,7 +44,6 @@ @function get-color-tokens($theme) { $system: m2-utils.get-system($theme); $is-dark: inspection.get-theme-type($theme) == dark; - $outline: inspection.get-theme-color($theme, system, outline); $disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%); $disabled-container : m3-utils.color-with-opacity(map.get($system, on-surface), 12%); @@ -61,12 +60,12 @@ map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)), button-filled-state-layer-color: map.get($system, on-surface), button-outlined-disabled-label-text-color: $disabled, - button-outlined-disabled-outline-color: $outline, + button-outlined-disabled-outline-color: map.get($system, outline), button-outlined-disabled-state-layer-color: map.get($system, on-surface-variant), button-outlined-focus-state-layer-opacity: map.get($system, focus-state-layer-opacity), button-outlined-hover-state-layer-opacity: map.get($system, hover-state-layer-opacity), button-outlined-label-text-color: map.get($system, on-surface), - button-outlined-outline-color: $outline, + button-outlined-outline-color: map.get($system, outline), button-outlined-pressed-state-layer-opacity: map.get($system, pressed-state-layer-opacity), button-outlined-ripple-color: m3-utils.color-with-opacity( map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)), diff --git a/src/material/card/_m2-card.scss b/src/material/card/_m2-card.scss index 4233d746b4bd..2cbb60feb3f8 100644 --- a/src/material/card/_m2-card.scss +++ b/src/material/card/_m2-card.scss @@ -23,7 +23,7 @@ card-elevated-container-elevation: elevation.get-box-shadow(1), card-outlined-container-color: map.get($system, surface), card-outlined-container-elevation: elevation.get-box-shadow(0), - card-outlined-outline-color: inspection.get-theme-color($theme, system, outline), + card-outlined-outline-color: map.get($system, outline), card-subtitle-text-color: map.get($system, on-surface-variant), card-filled-container-color: map.get($system, surface), card-filled-container-elevation: elevation.get-box-shadow(0) diff --git a/src/material/core/m2/_theming.scss b/src/material/core/m2/_theming.scss index 889dd6aa93bf..75ec69198da6 100644 --- a/src/material/core/m2/_theming.scss +++ b/src/material/core/m2/_theming.scss @@ -113,18 +113,34 @@ @return $theme; } -// Creates a light-themed color configuration from the specified -// primary, accent and warn palettes. -@function _mat-create-light-color-config($primary, $accent, $warn: null) { - $warn: if($warn != null, $warn, define-palette(palette.$red-palette)); - @return ( - primary: $primary, - accent: $accent, - warn: $warn, - is-dark: false, - foreground: palette.$light-theme-foreground-palette, - background: palette.$light-theme-background-palette, - system: ( +@function _define-system($primary, $accent, $warn, $is-dark) { + $system: ( + primary: map.get($primary, default), + on-primary: map.get($primary, default-contrast), + secondary: map.get($accent, default), + on-secondary: map.get($accent, default-contrast), + error: map.get($warn, default), + on-error: map.get($warn, default-contrast), + shadow: black, + hover-state-layer-opacity: 0.04, + focus-state-layer-opacity: 0.12, + pressed-state-layer-opacity: 0.12, + ); + + @if $is-dark { + @return map.merge($system, ( + surface: map.get(palette.$grey-palette, 800), + surface-variant: #4a4a4a, + on-surface: white, + on-surface-variant: rgba(white, 0.7), + background: #303030, + inverse-surface: white, + inverse-on-surface: rgba(black, 0.87), + outline: rgba(white, 0.12), + outline-variant: rgba(white, 0.38), + )); + } @else { + @return map.merge($system, ( surface: white, surface-variant: #f6f6f6, on-surface: rgba(black, 0.87), @@ -134,62 +150,34 @@ inverse-on-surface: white, outline: rgba(black, 0.12), outline-variant: rgba(black, 0.38), - hover-state-layer-opacity: 0.04, - focus-state-layer-opacity: 0.12, - pressed-state-layer-opacity: 0.12, - shadow: black, - primary: map.get($primary, default), - on-primary: map.get($primary, default-contrast), - secondary: map.get($accent, default), - on-secondary: map.get($accent, default-contrast), - error: map.get($warn, default), - on-error: map.get($warn, default-contrast), - ), - ); + )); + } } -// Creates a dark-themed color configuration from the specified +// Creates a color configuration from the specified // primary, accent and warn palettes. -@function _mat-create-dark-color-config($primary, $accent, $warn: null) { +@function _mat-create-color-config($primary, $accent, $warn: null, $is-dark) { $warn: if($warn != null, $warn, define-palette(palette.$red-palette)); + $foreground: + if($is-dark, palette.$dark-theme-foreground-palette, palette.$light-theme-foreground-palette); + $background: + if($is-dark, palette.$dark-theme-background-palette, palette.$light-theme-background-palette); + @return ( primary: $primary, accent: $accent, warn: $warn, - is-dark: true, - foreground: palette.$dark-theme-foreground-palette, - background: palette.$dark-theme-background-palette, - system: ( - surface: map.get(palette.$grey-palette, 800), - surface-variant: #4a4a4a, - on-surface: white, - on-surface-variant: rgba(white, 0.7), - background: #303030, - inverse-surface: white, - inverse-on-surface: rgba(black, 0.87), - outline: rgba(white, 0.12), - outline-variant: rgba(white, 0.38), - hover-state-layer-opacity: 0.04, - focus-state-layer-opacity: 0.12, - pressed-state-layer-opacity: 0.12, - shadow: black, - primary: map.get($primary, default), - on-primary: map.get($primary, default-contrast), - secondary: map.get($accent, default), - on-secondary: map.get($accent, default-contrast), - error: map.get($warn, default), - on-error: map.get($warn, default-contrast), - ), + is-dark: $is-dark, + foreground: $foreground, + background: $background, ); } -// TODO: Remove legacy API and rename `$primary` below to `$config`. Currently it cannot be renamed -// as it would break existing apps that set the parameter by name. - -/// Creates a container object for a light theme to be given to individual component theme mixins. +/// Creates a container object for a theme to be given to individual component theme mixins. /// @param {Map} $primary The theme configuration object. /// @returns {Map} A complete Angular Material theme map. -@function define-light-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) { +@function _define-theme( + $primary, $accent: null, $warn: define-palette(palette.$red-palette), $is-dark) { // This function creates a container object for the individual component theme mixins. Consumers // can construct such an object by calling this function, or by building the object manually. // There are two possible ways to invoke this function in order to create such an object: @@ -206,13 +194,15 @@ @if $accent != null { @warn theming.$private-legacy-theme-warning; $theme: _mat-validate-theme( - ( - _is-legacy-theme: true, - color: _mat-create-light-color-config($primary, $accent, $warn), - ) + ( + _is-legacy-theme: true, + color: _mat-create-color-config($primary, $accent, $warn, $is-dark), + ) ); - @return _internalize-theme(theming.private-create-backwards-compatibility-theme($theme)); + $theme: _internalize-theme(theming.private-create-backwards-compatibility-theme($theme)); + $theme: map.set($theme, _mat-system, _define-system($primary, $accent, $warn, $is-dark)); + @return $theme; } // If the map pattern is used (1), we just pass-through the configurations for individual // parts of the theming system, but update the `color` configuration if set. As explained @@ -224,15 +214,30 @@ $accent: map.get($color-settings, accent); $warn: map.get($color-settings, warn); $result: map.merge( - $result, - ( - color: _mat-create-light-color-config($primary, $accent, $warn), - ) + $result, + ( + color: _mat-create-color-config($primary, $accent, $warn, $is-dark), + ) ); } - @return _internalize-theme( - theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result)) + $theme: _internalize-theme( + theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result)) ); + $primary: map.get($result, primary) or map.get($result, color, primary) or (); + $accent: map.get($result, accent) or map.get($result, color, accent) or (); + $warn: map.get($result, warn) or map.get($result, color, warn) or (); + $theme: map.set($theme, _mat-system, _define-system($primary, $accent, $warn, $is-dark)); + @return $theme; +} + +// TODO: Remove legacy API and rename `$primary` below to `$config`. Currently it cannot be renamed +// as it would break existing apps that set the parameter by name. + +/// Creates a container object for a light theme to be given to individual component theme mixins. +/// @param {Map} $primary The theme configuration object. +/// @returns {Map} A complete Angular Material theme map. +@function define-light-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) { + @return _define-theme($primary, $accent, $warn, false); } // TODO: Remove legacy API and rename below `$primary` to `$config`. Currently it cannot be renamed @@ -242,48 +247,7 @@ /// @param {Map} $primary The theme configuration object. /// @returns {Map} A complete Angular Material theme map. @function define-dark-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) { - // This function creates a container object for the individual component theme mixins. Consumers - // can construct such an object by calling this function, or by building the object manually. - // There are two possible ways to invoke this function in order to create such an object: - // - // (1) Passing in a map that holds optional configurations for individual parts of the - // theming system. For `color` configurations, the function only expects the palettes - // for `primary` and `accent` (and optionally `warn`). The function will expand the - // shorthand into an actual configuration that can be consumed in `-color` mixins. - // (2) Legacy pattern: Passing in the palettes as parameters. This is not as flexible - // as passing in a configuration map because only the `color` system can be configured. - // - // If the legacy pattern is used, we generate a container object only with a dark-themed - // configuration for the `color` theming part. - @if $accent != null { - @warn theming.$private-legacy-theme-warning; - $theme: _mat-validate-theme( - ( - _is-legacy-theme: true, - color: _mat-create-dark-color-config($primary, $accent, $warn), - ) - ); - @return _internalize-theme(theming.private-create-backwards-compatibility-theme($theme)); - } - // If the map pattern is used (1), we just pass-through the configurations for individual - // parts of the theming system, but update the `color` configuration if set. As explained - // above, the color shorthand will be expanded to an actual dark-themed color configuration. - $result: $primary; - @if map.get($primary, color) { - $color-settings: map.get($primary, color); - $primary: map.get($color-settings, primary); - $accent: map.get($color-settings, accent); - $warn: map.get($color-settings, warn); - $result: map.merge( - $result, - ( - color: _mat-create-dark-color-config($primary, $accent, $warn), - ) - ); - } - @return _internalize-theme( - theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result)) - ); + @return _define-theme($primary, $accent, $warn, true); } /// Gets the color configuration from the given theme or configuration. diff --git a/src/material/core/option/_m2-optgroup.scss b/src/material/core/option/_m2-optgroup.scss index 6632e8b33176..37499286aaec 100644 --- a/src/material/core/option/_m2-optgroup.scss +++ b/src/material/core/option/_m2-optgroup.scss @@ -1,4 +1,6 @@ @use '../theming/inspection'; +@use '../tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -8,8 +10,9 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); @return ( - optgroup-label-text-color: inspection.get-theme-color($theme, system, on-surface), + optgroup-label-text-color: map.get($system, on-surface), ); } diff --git a/src/material/core/option/_m2-option.scss b/src/material/core/option/_m2-option.scss index c39fef5a140d..6f8eecd5abfc 100644 --- a/src/material/core/option/_m2-option.scss +++ b/src/material/core/option/_m2-option.scss @@ -17,7 +17,7 @@ @return ( option-selected-state-label-text-color: map.get($system, primary), - option-label-text-color: inspection.get-theme-color($theme, system, on-surface), + option-label-text-color: map.get($system, on-surface), option-hover-state-layer-color: m3-utils.color-with-opacity( map.get($system, on-surface), map.get($system, hover-state-layer-opacity)), option-focus-state-layer-color: m3-utils.color-with-opacity( diff --git a/src/material/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss b/src/material/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss index d088f0930795..756c491cca22 100644 --- a/src/material/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +++ b/src/material/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss @@ -13,15 +13,14 @@ @function get-color-tokens($theme, $color-variant) { $is-dark: inspection.get-theme-type($theme) == dark; $disabled-color: if($is-dark, #686868, #b0b0b0); - $checkmark-color: inspection.get-theme-color($theme, system, background); $system: m2-utils.get-system($theme); $system: m3-utils.replace-colors-with-variant($system, secondary, $color-variant); @return ( pseudo-checkbox-full-selected-icon-color: map.get($system, secondary), - pseudo-checkbox-full-selected-checkmark-color: $checkmark-color, + pseudo-checkbox-full-selected-checkmark-color: map.get($system, background), pseudo-checkbox-full-unselected-icon-color: map.get($system, on-surface-variant), - pseudo-checkbox-full-disabled-selected-checkmark-color: $checkmark-color, + pseudo-checkbox-full-disabled-selected-checkmark-color: map.get($system, background), pseudo-checkbox-full-disabled-unselected-icon-color: $disabled-color, pseudo-checkbox-full-disabled-selected-icon-color: $disabled-color, pseudo-checkbox-minimal-selected-checkmark-color: map.get($system, secondary), diff --git a/src/material/core/tokens/_m2-utils.scss b/src/material/core/tokens/_m2-utils.scss index c3598982f8e7..6f70c123d281 100644 --- a/src/material/core/tokens/_m2-utils.scss +++ b/src/material/core/tokens/_m2-utils.scss @@ -8,17 +8,7 @@ $private-is-internal-build: false; // Gets the theme's system values as a flat map. @function get-system($theme) { - $system: map.get($theme, _mat-theming-internals-do-not-access, m2-config, color, system); - @if $system { - @return $system; - } - - $system: map.get($theme, system); - @if $system { - @return $system; - } - - $system: map.get($theme, color, system); + $system: map.get($theme, _mat-system); @if $system { @return $system; } diff --git a/src/material/dialog/_m2-dialog.scss b/src/material/dialog/_m2-dialog.scss index 73e4a07752a9..0068f1c2381f 100644 --- a/src/material/dialog/_m2-dialog.scss +++ b/src/material/dialog/_m2-dialog.scss @@ -1,5 +1,7 @@ @use '../core/style/elevation'; @use '../core/theming/inspection'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -23,11 +25,11 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { - $is-dark: inspection.get-theme-type($theme) == dark; + $system: m2-utils.get-system($theme); @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, system, on-surface-variant), + dialog-container-color: map.get($system, surface), + dialog-subhead-color: map.get($system, on-surface), + dialog-supporting-text-color: map.get($system, on-surface-variant), ); } diff --git a/src/material/divider/_m2-divider.scss b/src/material/divider/_m2-divider.scss index 1dd41578ccf3..5f8dabad9cbe 100644 --- a/src/material/divider/_m2-divider.scss +++ b/src/material/divider/_m2-divider.scss @@ -1,4 +1,5 @@ -@use '../core/theming/inspection'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -10,8 +11,9 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); @return ( - divider-color: inspection.get-theme-color($theme, system, outline) + divider-color: map.get($system, outline) ); } diff --git a/src/material/form-field/_m2-form-field.scss b/src/material/form-field/_m2-form-field.scss index eaa40481861b..229779534fea 100644 --- a/src/material/form-field/_m2-form-field.scss +++ b/src/material/form-field/_m2-form-field.scss @@ -33,8 +33,8 @@ @return map.merge($color-tokens, ( // MDC has a token for the enabled placeholder, but not for the disabled one. form-field-disabled-input-text-placeholder-color: $disabled, - form-field-state-layer-color: inspection.get-theme-color($theme, system, on-surface), - form-field-error-text-color: inspection.get-theme-color($theme, warn), + form-field-state-layer-color: map.get($system, on-surface), + form-field-error-text-color: map.get($system, error), // On dark themes we set the native `select` color to some shade of white, // however the color propagates to all of the `option` elements, which are diff --git a/src/material/menu/_m2-menu.scss b/src/material/menu/_m2-menu.scss index c2c33ba2a392..5d5d74ed970b 100644 --- a/src/material/menu/_m2-menu.scss +++ b/src/material/menu/_m2-menu.scss @@ -29,14 +29,14 @@ $system: m2-utils.get-system($theme); @return ( - menu-item-label-text-color: inspection.get-theme-color($theme, system, on-surface), - menu-item-icon-color: inspection.get-theme-color($theme, system, on-surface), + menu-item-label-text-color: map.get($system, on-surface), + menu-item-icon-color: map.get($system, on-surface), menu-item-hover-state-layer-color: m3-utils.color-with-opacity( map.get($system, on-surface), map.get($system, hover-state-layer-opacity)), menu-item-focus-state-layer-color: m3-utils.color-with-opacity( map.get($system, on-surface), map.get($system, focus-state-layer-opacity)), - menu-container-color: inspection.get-theme-color($theme, system, surface), - menu-divider-color: inspection.get-theme-color($theme, system, outline), + menu-container-color: map.get($system, surface), + menu-divider-color: map.get($system, outline), ); } diff --git a/src/material/slider/_m2-slider.scss b/src/material/slider/_m2-slider.scss index 7498501afaa0..808331c49efc 100644 --- a/src/material/slider/_m2-slider.scss +++ b/src/material/slider/_m2-slider.scss @@ -46,8 +46,7 @@ slider-label-label-text-color: map.get($system, inverse-on-surface), slider-value-indicator-opacity: 1, slider-with-overlap-handle-outline-color: map.get($system, on-surface), - slider-with-tick-marks-disabled-container-color: - inspection.get-theme-color($theme, system, on-surface), + slider-with-tick-marks-disabled-container-color: map.get($system, on-surface), ), ); } diff --git a/src/material/snack-bar/_m2-snack-bar.scss b/src/material/snack-bar/_m2-snack-bar.scss index 42878bbfb415..c861d63eea9d 100644 --- a/src/material/snack-bar/_m2-snack-bar.scss +++ b/src/material/snack-bar/_m2-snack-bar.scss @@ -14,7 +14,6 @@ @function get-color-tokens($theme) { $is-dark: inspection.get-theme-type($theme) == dark; $system: m2-utils.get-system($theme); - $surface: inspection.get-theme-color($theme, system, surface); @return ( snack-bar-container-color: map.get($system, inverse-surface), diff --git a/src/material/sort/_m2-sort.scss b/src/material/sort/_m2-sort.scss index 6435056c38e9..1b3ebd714a29 100644 --- a/src/material/sort/_m2-sort.scss +++ b/src/material/sort/_m2-sort.scss @@ -1,4 +1,5 @@ -@use '../core/theming/inspection'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -8,8 +9,10 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); + @return ( - sort-arrow-color: inspection.get-theme-color($theme, system, on-surface), + sort-arrow-color: map.get($system, on-surface), ); } diff --git a/src/material/table/_m2-table.scss b/src/material/table/_m2-table.scss index 8831e2b82bb8..708928fc9f04 100644 --- a/src/material/table/_m2-table.scss +++ b/src/material/table/_m2-table.scss @@ -1,6 +1,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. @@ -12,12 +13,13 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { - @return ( - table-background-color: inspection.get-theme-color($theme, system, surface), + $system: m2-utils.get-system($theme); - 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, system, outline), + @return ( + table-background-color: map.get($system, surface), + table-header-headline-color: map.get($system, on-surface), + table-row-item-label-text-color: map.get($system, on-surface), + table-row-item-outline-color: map.get($system, outline), ); } diff --git a/src/material/tabs/_m2-tabs.scss b/src/material/tabs/_m2-tabs.scss index 7df174edf306..85a5138ac194 100644 --- a/src/material/tabs/_m2-tabs.scss +++ b/src/material/tabs/_m2-tabs.scss @@ -32,7 +32,7 @@ $tokens: ( tab-disabled-ripple-color: map.get($system, on-surface-variant), - tab-pagination-icon-color: inspection.get-theme-color($theme, system, on-surface), + tab-pagination-icon-color: map.get($system, on-surface), tab-inactive-label-text-color: map.get($system, on-surface-variant), tab-active-label-text-color: map.get($system, primary), tab-active-ripple-color: map.get($system, primary), diff --git a/src/material/timepicker/_m2-timepicker.scss b/src/material/timepicker/_m2-timepicker.scss index ec5f4572c6cb..5f8653081cca 100644 --- a/src/material/timepicker/_m2-timepicker.scss +++ b/src/material/timepicker/_m2-timepicker.scss @@ -1,5 +1,6 @@ -@use '../core/theming/inspection'; @use '../core/style/elevation'; +@use '../core/tokens/m2-utils'; +@use 'sass:map'; // Tokens that can't be configured through Angular Material's current theming API, // but may be in a future version of the theming API. @@ -12,8 +13,10 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); + @return ( - timepicker-container-background-color: inspection.get-theme-color($theme, system, surface) + timepicker-container-background-color: map.get($system, surface) ); } diff --git a/src/material/toolbar/_m2-toolbar.scss b/src/material/toolbar/_m2-toolbar.scss index 64ae0dc9c02c..fed39baf2441 100644 --- a/src/material/toolbar/_m2-toolbar.scss +++ b/src/material/toolbar/_m2-toolbar.scss @@ -1,6 +1,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. @@ -10,9 +11,10 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); @return private-get-color-palette-color-tokens( - $background-color: inspection.get-theme-color($theme, system, surface), - $text-color: inspection.get-theme-color($theme, system, on-surface), + $background-color: map.get($system, surface), + $text-color: map.get($system, on-surface), ); } diff --git a/src/material/tree/_m2-tree.scss b/src/material/tree/_m2-tree.scss index b597b5a4571b..1adb9a466e05 100644 --- a/src/material/tree/_m2-tree.scss +++ b/src/material/tree/_m2-tree.scss @@ -1,6 +1,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. @@ -10,9 +11,11 @@ // Tokens that can be configured through Angular Material's color theming API. @function get-color-tokens($theme) { + $system: m2-utils.get-system($theme); + @return ( - tree-container-background-color: inspection.get-theme-color($theme, system, surface), - tree-node-text-color: inspection.get-theme-color($theme, system, on-surface), + tree-container-background-color: map.get($system, surface), + tree-node-text-color: map.get($system, on-surface), ); }