|
23 | 23 | inverse-on-surface: rgba(black, 0.87), |
24 | 24 | outline: rgba(white, 0.12), |
25 | 25 | outline-variant: rgba(white, 0.38), |
26 | | - error-container: rgba(map.get($palettes, warn, 300), 0.24), |
| 26 | + error-container: safe-rgba(map.get($palettes, warn, 300), 0.24), |
27 | 27 | on-background: white, |
28 | 28 | on-error-container: map.get($palettes, warn, 100), |
29 | 29 | on-primary-container: map.get($palettes, primary, 100), |
|
36 | 36 | on-tertiary-container: map.get($palettes, accent, 100), |
37 | 37 | on-tertiary-fixed: map.get($palettes, accent, default-contrast), |
38 | 38 | on-tertiary-fixed-variant: map.get($palettes, accent, default-contrast), |
39 | | - primary-container: rgba(map.get($palettes, primary, 300), 0.24), |
| 39 | + primary-container: safe-rgba(map.get($palettes, primary, 300), 0.24), |
40 | 40 | primary-fixed: map.get($palettes, primary, default), |
41 | 41 | primary-fixed-dim: map.get($palettes, primary, default), |
42 | 42 | scrim: black, |
43 | | - secondary-container: rgba(map.get($palettes, accent, 300), 0.24), |
| 43 | + secondary-container: safe-rgba(map.get($palettes, accent, 300), 0.24), |
44 | 44 | secondary-fixed: map.get($palettes, accent, default), |
45 | 45 | secondary-fixed-dim: map.get($palettes, accent, default), |
46 | 46 | surface-bright: map.get(palette.$grey-palette, 800), |
|
52 | 52 | surface-dim: map.get(palette.$grey-palette, 800), |
53 | 53 | surface-tint: map.get(palette.$grey-palette, 800), |
54 | 54 | tertiary: map.get($palettes, accent, default), |
55 | | - tertiary-container: rgba(map.get($palettes, accent, 300), 0.24), |
| 55 | + tertiary-container: safe-rgba(map.get($palettes, accent, 300), 0.24), |
56 | 56 | tertiary-fixed: map.get($palettes, accent, default), |
57 | 57 | tertiary-fixed-dim: map.get($palettes, accent, default), |
58 | 58 | ); |
|
121 | 121 |
|
122 | 122 | @return $values; |
123 | 123 | } |
| 124 | + |
| 125 | +// Returns the rgba value for the provided color and opacity. If color is null, |
| 126 | +// then it returns null. If rgba is used in these cases, Sass throws an error. |
| 127 | +@function safe-rgba($color, $opacity) { |
| 128 | + @if $color == null { |
| 129 | + @return null; |
| 130 | + } |
| 131 | + @return rgba($color, $opacity); |
| 132 | +} |
0 commit comments