File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 2929/// Validates that the given object is an M3 palette.
3030/// @param {*} $palette The object to test
3131/// @return {Boolean|null} null if it is a valid M3 palette, else true.
32- @function _validate -palette ($palette ) {
32+ @function validate -palette ($palette ) {
3333 @if not meta .type-of ($palette ) == ' map' {
3434 @return true;
3535 }
108108 }
109109 @each $palette in (primary, secondary, tertiary) {
110110 @if $config and map .has-key ($config , $palette ) {
111- $err : _validate -palette (map .get ($config , $palette ));
111+ $err : validate -palette (map .get ($config , $palette ));
112112 @if $err {
113113 @return (
114114 #{' Expected $config.#{$palette } to be a valid M3 palette. Got:' }
Original file line number Diff line number Diff line change 11@use ' ../style/elevation' ;
22@use ' ../style/sass-utils' ;
3+ @use ' ../theming/config-validation' ;
34@use ' ../theming/definition' ;
45@use ' ./m3/definitions' ;
56@use ' sass:map' ;
@@ -44,9 +45,12 @@ $_system-level-prefix: sys;
4445 $color : map .get ($config , color );
4546 $color-config : null;
4647 @if ($color ) {
47- $color-config : if (meta .type-of ($color ) == ' map' ,
48- definition .define-colors ($color ),
49- definition .define-colors ((primary: $color )));
48+ // validate-palette returns null if it is a valid M3 palette
49+ $is-palette : config-validation .validate-palette ($color ) == null;
50+
51+ $color-config : if ($is-palette ,
52+ definition .define-colors ((primary: $color )),
53+ definition .define-colors ($color ));
5054 @include system-level-colors ($color-config , $overrides , $_system-fallback-prefix );
5155 @include system-level-elevation ($color-config , $overrides , $_system-fallback-prefix );
5256 }
You can’t perform that action at this time.
0 commit comments