[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use 'theming/theming';
|
---|
| 3 | @use './style/private';
|
---|
| 4 | @use './ripple/ripple-theme';
|
---|
| 5 | @use './option/option-theme';
|
---|
| 6 | @use './option/optgroup-theme';
|
---|
| 7 | @use './selection/pseudo-checkbox/pseudo-checkbox-theme';
|
---|
| 8 | @use './style/elevation';
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | @mixin color($config-or-theme) {
|
---|
| 12 | $config: theming.get-color-config($config-or-theme);
|
---|
| 13 | // Wrapper element that provides the theme background when the user's content isn't
|
---|
| 14 | // inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand
|
---|
| 15 | // selector in case the mixin is included at the top level.
|
---|
| 16 | .mat-app-background#{if(&, ', &.mat-app-background', '')} {
|
---|
| 17 | $background: map.get($config, background);
|
---|
| 18 | $foreground: map.get($config, foreground);
|
---|
| 19 |
|
---|
| 20 | background-color: theming.get-color-from-palette($background, background);
|
---|
| 21 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | // Provides external CSS classes for each elevation value. Each CSS class is formatted as
|
---|
| 25 | // `mat-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the element is
|
---|
| 26 | // elevated.
|
---|
| 27 | @for $zValue from 0 through 24 {
|
---|
| 28 | .#{elevation.$prefix}#{$zValue} {
|
---|
| 29 | @include private.private-theme-elevation($zValue, $config);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | // Marker that is used to determine whether the user has added a theme to their page.
|
---|
| 34 | @at-root {
|
---|
| 35 | .mat-theme-loaded-marker {
|
---|
| 36 | display: none;
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | // Mixin that renders all of the core styles that depend on the theme.
|
---|
| 42 | @mixin theme($theme-or-color-config) {
|
---|
| 43 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 44 | // Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
|
---|
| 45 | // there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then
|
---|
| 46 | // the imported themes (such as `mat-ripple-theme`) should not report again.
|
---|
| 47 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-core') {
|
---|
| 48 | @include ripple-theme.theme($theme);
|
---|
| 49 | @include option-theme.theme($theme);
|
---|
| 50 | @include optgroup-theme.theme($theme);
|
---|
| 51 | @include pseudo-checkbox-theme.theme($theme);
|
---|
| 52 |
|
---|
| 53 | $color: theming.get-color-config($theme);
|
---|
| 54 | @if $color != null {
|
---|
| 55 | @include color($color);
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 | }
|
---|