[6a3a178] | 1 | @use 'sass:color';
|
---|
| 2 | @use 'sass:map';
|
---|
| 3 | @use 'sass:meta';
|
---|
| 4 | @use '../core/style/private';
|
---|
| 5 | @use '../core/theming/theming';
|
---|
| 6 |
|
---|
| 7 | @mixin color($config-or-theme) {
|
---|
| 8 | $config: theming.get-color-config($config-or-theme);
|
---|
| 9 | $primary: map.get($config, primary);
|
---|
| 10 | $accent: map.get($config, accent);
|
---|
| 11 | $warn: map.get($config, warn);
|
---|
| 12 | $background: map.get($config, background);
|
---|
| 13 | $foreground: map.get($config, foreground);
|
---|
| 14 |
|
---|
| 15 | $drawer-background-color: theming.get-color-from-palette($background, dialog);
|
---|
| 16 | $drawer-container-background-color: theming.get-color-from-palette($background, background);
|
---|
| 17 | $drawer-push-background-color: theming.get-color-from-palette($background, dialog);
|
---|
| 18 | $drawer-side-border: solid 1px theming.get-color-from-palette($foreground, divider);
|
---|
| 19 |
|
---|
| 20 | .mat-drawer-container {
|
---|
| 21 | background-color: $drawer-container-background-color;
|
---|
| 22 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | .mat-drawer {
|
---|
| 26 | background-color: $drawer-background-color;
|
---|
| 27 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 28 |
|
---|
| 29 | &.mat-drawer-push {
|
---|
| 30 | background-color: $drawer-push-background-color;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | &:not(.mat-drawer-side) {
|
---|
| 34 | // The elevation of z-16 is noted in the design specifications.
|
---|
| 35 | // See https://material.io/design/components/navigation-drawer.html
|
---|
| 36 | @include private.private-theme-elevation(16, $config);
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | .mat-drawer-side {
|
---|
| 41 | border-right: $drawer-side-border;
|
---|
| 42 |
|
---|
| 43 | &.mat-drawer-end {
|
---|
| 44 | border-left: $drawer-side-border;
|
---|
| 45 | border-right: none;
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | [dir='rtl'] .mat-drawer-side {
|
---|
| 50 | border-left: $drawer-side-border;
|
---|
| 51 | border-right: none;
|
---|
| 52 |
|
---|
| 53 | &.mat-drawer-end {
|
---|
| 54 | border-left: none;
|
---|
| 55 | border-right: $drawer-side-border;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | .mat-drawer-backdrop.mat-drawer-shown {
|
---|
| 60 | $opacity: 0.6;
|
---|
| 61 | $backdrop-color: theming.get-color-from-palette($background, card, $opacity);
|
---|
| 62 |
|
---|
| 63 | @if (meta.type-of($backdrop-color) == color) {
|
---|
| 64 | // We use invert() here to have the darken the background color expected to be used. If the
|
---|
| 65 | // background is light, we use a dark backdrop. If the background is dark,
|
---|
| 66 | // we use a light backdrop.
|
---|
| 67 | background-color: color.invert($backdrop-color);
|
---|
| 68 | }
|
---|
| 69 | @else {
|
---|
| 70 | // If we couldn't resolve the backdrop color to a color value, fall back to using
|
---|
| 71 | // `opacity` to make it opaque since its end value could be a solid color.
|
---|
| 72 | background-color: $backdrop-color;
|
---|
| 73 | opacity: $opacity;
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | @mixin typography($config-or-theme) {}
|
---|
| 79 |
|
---|
| 80 | @mixin _density($config-or-theme) {}
|
---|
| 81 |
|
---|
| 82 | @mixin theme($theme-or-color-config) {
|
---|
| 83 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 84 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-sidenav') {
|
---|
| 85 | $color: theming.get-color-config($theme);
|
---|
| 86 | $density: theming.get-density-config($theme);
|
---|
| 87 | $typography: theming.get-typography-config($theme);
|
---|
| 88 |
|
---|
| 89 | @if $color != null {
|
---|
| 90 | @include color($color);
|
---|
| 91 | }
|
---|
| 92 | @if $density != null {
|
---|
| 93 | @include _density($density);
|
---|
| 94 | }
|
---|
| 95 | @if $typography != null {
|
---|
| 96 | @include typography($typography);
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | }
|
---|