|
2 | 2 | @use '../../m2/palette'; |
3 | 3 |
|
4 | 4 | @function md-sys-color-values-dark($palettes) { |
| 5 | + @debug $palettes; |
5 | 6 | @return ( |
6 | 7 | primary: map.get($palettes, primary, default), |
7 | 8 | on-primary: map.get($palettes, primary, default-contrast), |
|
22 | 23 | inverse-on-surface: rgba(black, 0.87), |
23 | 24 | outline: rgba(white, 0.12), |
24 | 25 | outline-variant: rgba(white, 0.38), |
25 | | - error-container: rgba(map.get($palettes, warn, 300), 0.24), |
| 26 | + error-container: safe-rgba(map.get($palettes, warn, 300), 0.24), |
26 | 27 | on-background: white, |
27 | 28 | on-error-container: map.get($palettes, warn, 100), |
28 | 29 | on-primary-container: map.get($palettes, primary, 100), |
|
35 | 36 | on-tertiary-container: map.get($palettes, accent, 100), |
36 | 37 | on-tertiary-fixed: map.get($palettes, accent, default-contrast), |
37 | 38 | on-tertiary-fixed-variant: map.get($palettes, accent, default-contrast), |
38 | | - primary-container: rgba(map.get($palettes, primary, 300), 0.24), |
| 39 | + primary-container: safe-rgba(map.get($palettes, primary, 300), 0.24), |
39 | 40 | primary-fixed: map.get($palettes, primary, default), |
40 | 41 | primary-fixed-dim: map.get($palettes, primary, default), |
41 | 42 | scrim: black, |
42 | | - secondary-container: rgba(map.get($palettes, accent, 300), 0.24), |
| 43 | + secondary-container: safe-rgba(map.get($palettes, accent, 300), 0.24), |
43 | 44 | secondary-fixed: map.get($palettes, accent, default), |
44 | 45 | secondary-fixed-dim: map.get($palettes, accent, default), |
45 | 46 | surface-bright: map.get(palette.$grey-palette, 800), |
|
51 | 52 | surface-dim: map.get(palette.$grey-palette, 800), |
52 | 53 | surface-tint: map.get(palette.$grey-palette, 800), |
53 | 54 | tertiary: map.get($palettes, accent, default), |
54 | | - tertiary-container: rgba(map.get($palettes, accent, 300), 0.24), |
| 55 | + tertiary-container: safe-rgba(map.get($palettes, accent, 300), 0.24), |
55 | 56 | tertiary-fixed: map.get($palettes, accent, default), |
56 | 57 | tertiary-fixed-dim: map.get($palettes, accent, default), |
57 | 58 | ); |
|
112 | 113 | tertiary-fixed-dim: map.get($palettes, accent, default), |
113 | 114 | ); |
114 | 115 | } |
| 116 | + |
| 117 | +// Returns the rgba value for the provided color and opacity. If color is null, |
| 118 | +// then it returns null. If rgba is used in these cases, Sass throws an error. |
| 119 | +@function safe-rgba($color, $opacity) { |
| 120 | + @if $color == null { |
| 121 | + @return null; |
| 122 | + } |
| 123 | + @return rgba($color, $opacity); |
| 124 | +} |
0 commit comments