|
1 | 1 | @use '../style/elevation';
|
2 | 2 | @use '../style/sass-utils';
|
| 3 | +@use '../theming/config-validation'; |
3 | 4 | @use '../theming/definition';
|
4 | 5 | @use './m3/definitions';
|
5 | 6 | @use 'sass:map';
|
@@ -44,14 +45,17 @@ $_system-level-prefix: sys;
|
44 | 45 | $color: map.get($config, color);
|
45 | 46 | $color-config: null;
|
46 | 47 | @if ($color) {
|
| 48 | + // validate-palette returns null if it is a valid M3 palette |
| 49 | + $is-palette: config-validation.validate-palette($color) == null; |
| 50 | + |
47 | 51 | // Default to "color-scheme" theme type if the config's color does not provide one.
|
48 |
| - @if (meta.type-of($color) == 'map' and not map.has-key($color, theme-type)) { |
| 52 | + @if (not $is-palette and not map.has-key($color, theme-type)) { |
49 | 53 | $color: map.set($color, theme-type, color-scheme);
|
50 | 54 | }
|
51 | 55 |
|
52 |
| - $color-config: if(meta.type-of($color) == 'map', |
53 |
| - definition.define-colors($color), |
54 |
| - definition.define-colors((primary: $color, theme-type: color-scheme))); |
| 56 | + $color-config: if($is-palette, |
| 57 | + definition.define-colors((primary: $color, theme-type: color-scheme)), |
| 58 | + definition.define-colors($color)); |
55 | 59 | @include system-level-colors($color-config, $overrides, $_system-fallback-prefix);
|
56 | 60 | @include system-level-elevation($color-config, $overrides, $_system-fallback-prefix);
|
57 | 61 | }
|
|
0 commit comments