diff --git a/src/dev-app/theme.scss b/src/dev-app/theme.scss index 9a4eb8c6e9d3..0f0d6cd16621 100644 --- a/src/dev-app/theme.scss +++ b/src/dev-app/theme.scss @@ -25,6 +25,7 @@ $candy-app-theme: mat.m2-define-light-theme(( // have to load a single css file for Angular Material in your app. // **Be sure that you only ever include this mixin once!** @include mat.core(); +@include mat.app-background(); // Include the default theme styles. @include mat.all-component-themes($candy-app-theme); diff --git a/src/material/_index.scss b/src/material/_index.scss index b00dcc5996e6..0f0479b3b594 100644 --- a/src/material/_index.scss +++ b/src/material/_index.scss @@ -36,7 +36,7 @@ @forward './core/style/validation' as private-*; // Structural -@forward './core/core' show core; +@forward './core/core' show core, app-background; @forward './core/ripple/ripple' show ripple; @forward './core/focus-indicators/private' show strong-focus-indicators, strong-focus-indicators-color, strong-focus-indicators-theme; diff --git a/src/material/core/_core.scss b/src/material/core/_core.scss index f0080ea547a8..ae8b36bfc8bb 100644 --- a/src/material/core/_core.scss +++ b/src/material/core/_core.scss @@ -22,11 +22,6 @@ @at-root { // Note: we need to emit fallback values here to avoid errors in internal builds. @include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) { - .mat-app-background { - @include token-utils.create-token-slot(background-color, background-color, transparent); - @include token-utils.create-token-slot(color, text-color, inherit); - } - // Provides external CSS classes for each elevation value. Each CSS class is formatted as // `mat-elevation-z$z-value` where `$z-value` corresponds to the z-space to which the element // is elevated. @@ -42,3 +37,15 @@ } } } + +// Mixin that provides the .mat-app-background class. +@mixin app-background() { + @at-root { + @include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) { + .mat-app-background { + @include token-utils.create-token-slot(background-color, background-color, transparent); + @include token-utils.create-token-slot(color, text-color, inherit); + } + } + } +} diff --git a/src/universal-app/styles.scss b/src/universal-app/styles.scss index 9e1af4470a0e..a043f31c880e 100644 --- a/src/universal-app/styles.scss +++ b/src/universal-app/styles.scss @@ -1,6 +1,7 @@ @use '@angular/material' as mat; @include mat.core(); +@include mat.app-background(); $theme: mat.define-theme(( color: (