[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use 'sass:meta';
|
---|
| 3 | @use 'sass:color';
|
---|
| 4 | @use '../core/theming/theming';
|
---|
| 5 |
|
---|
| 6 | // Approximates the correct buffer color by using a mix between the theme color
|
---|
| 7 | // and the theme's background color.
|
---|
| 8 | @function _get-buffer-color($theme, $background) {
|
---|
| 9 | $theme-color: theming.get-color-from-palette($theme);
|
---|
| 10 | // Return fallback color if the theme uses variables to define colors.
|
---|
| 11 | @if (meta.type-of($theme-color) != 'color' or meta.type-of($background) != 'color') {
|
---|
| 12 | @return theming.get-color-from-palette($theme, lighter);
|
---|
| 13 | }
|
---|
| 14 | @return color.mix($theme-color, $background, $weight: 25%);
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | @mixin color($config-or-theme) {
|
---|
| 18 | $config: theming.get-color-config($config-or-theme);
|
---|
| 19 | $primary: map.get($config, primary);
|
---|
| 20 | $accent: map.get($config, accent);
|
---|
| 21 | $warn: map.get($config, warn);
|
---|
| 22 | $background: map.get(map.get($config, background), background);
|
---|
| 23 |
|
---|
| 24 | .mat-progress-bar-background {
|
---|
| 25 | fill: _get-buffer-color($primary, $background);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | .mat-progress-bar-buffer {
|
---|
| 29 | background-color: _get-buffer-color($primary, $background);
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | .mat-progress-bar-fill::after {
|
---|
| 33 | background-color: theming.get-color-from-palette($primary);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | .mat-progress-bar.mat-accent {
|
---|
| 37 | .mat-progress-bar-background {
|
---|
| 38 | fill: _get-buffer-color($accent, $background);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | .mat-progress-bar-buffer {
|
---|
| 42 | background-color: _get-buffer-color($accent, $background);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | .mat-progress-bar-fill::after {
|
---|
| 46 | background-color: theming.get-color-from-palette($accent);
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | .mat-progress-bar.mat-warn {
|
---|
| 51 | .mat-progress-bar-background {
|
---|
| 52 | fill: _get-buffer-color($warn, $background);
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | .mat-progress-bar-buffer {
|
---|
| 56 | background-color: _get-buffer-color($warn, $background);
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | .mat-progress-bar-fill::after {
|
---|
| 60 | background-color: theming.get-color-from-palette($warn);
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | @mixin typography($config-or-theme) {}
|
---|
| 66 |
|
---|
| 67 | @mixin _density($config-or-theme) {}
|
---|
| 68 |
|
---|
| 69 | @mixin theme($theme-or-color-config) {
|
---|
| 70 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 71 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-progress-bar') {
|
---|
| 72 | $color: theming.get-color-config($theme);
|
---|
| 73 | $density: theming.get-density-config($theme);
|
---|
| 74 | $typography: theming.get-typography-config($theme);
|
---|
| 75 |
|
---|
| 76 | @if $color != null {
|
---|
| 77 | @include color($color);
|
---|
| 78 | }
|
---|
| 79 | @if $density != null {
|
---|
| 80 | @include _density($density);
|
---|
| 81 | }
|
---|
| 82 | @if $typography != null {
|
---|
| 83 | @include typography($typography);
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 |
|
---|