|
1 | 1 | @use 'sass:map';
|
| 2 | +@use 'sass:meta'; |
| 3 | +@use 'sass:color'; |
2 | 4 | @use '../core/theming/palette';
|
3 | 5 | @use '../core/theming/theming';
|
4 | 6 |
|
| 7 | +// Approximates the correct buffer color by using a mix between the theme color |
| 8 | +// and the theme's background color. |
| 9 | +@function _get-buffer-color($theme, $background) { |
| 10 | + $theme-color: theming.color($theme); |
| 11 | + // Return fallback color if the theme uses variables to define colors. |
| 12 | + @if (meta.type-of($theme-color) != 'color' or meta.type-of($background) != 'color') { |
| 13 | + @return theming.color($theme, lighter); |
| 14 | + } |
| 15 | + @return color.mix($theme-color, $background, $weight: 25%); |
| 16 | +} |
| 17 | + |
5 | 18 | @mixin color($config-or-theme) {
|
6 | 19 | $config: theming.get-color-config($config-or-theme);
|
7 | 20 | $primary: map.get($config, primary);
|
8 | 21 | $accent: map.get($config, accent);
|
9 | 22 | $warn: map.get($config, warn);
|
| 23 | + $background: map.get(map.get($config, background), background); |
10 | 24 |
|
11 | 25 | .mat-progress-bar-background {
|
12 |
| - fill: theming.color($primary, lighter); |
| 26 | + fill: _get-buffer-color($primary, $background); |
13 | 27 | }
|
14 | 28 |
|
15 | 29 | .mat-progress-bar-buffer {
|
16 |
| - background-color: theming.color($primary, lighter); |
| 30 | + background-color: _get-buffer-color($primary, $background); |
17 | 31 | }
|
18 | 32 |
|
19 | 33 | .mat-progress-bar-fill::after {
|
|
22 | 36 |
|
23 | 37 | .mat-progress-bar.mat-accent {
|
24 | 38 | .mat-progress-bar-background {
|
25 |
| - fill: theming.color($accent, lighter); |
| 39 | + fill: _get-buffer-color($accent, $background); |
26 | 40 | }
|
27 | 41 |
|
28 | 42 | .mat-progress-bar-buffer {
|
29 |
| - background-color: theming.color($accent, lighter); |
| 43 | + background-color: _get-buffer-color($accent, $background); |
30 | 44 | }
|
31 | 45 |
|
32 | 46 | .mat-progress-bar-fill::after {
|
|
36 | 50 |
|
37 | 51 | .mat-progress-bar.mat-warn {
|
38 | 52 | .mat-progress-bar-background {
|
39 |
| - fill: theming.color($warn, lighter); |
| 53 | + fill: _get-buffer-color($warn, $background); |
40 | 54 | }
|
41 | 55 |
|
42 | 56 | .mat-progress-bar-buffer {
|
43 |
| - background-color: theming.color($warn, lighter); |
| 57 | + background-color: _get-buffer-color($warn, $background); |
44 | 58 | }
|
45 | 59 |
|
46 | 60 | .mat-progress-bar-fill::after {
|
|
0 commit comments