Skip to content

Commit

Permalink
fix(color): prevent prefix null configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
borisdamevin committed May 12, 2024
1 parent 9b2813b commit 54a1ef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/color/__tests__/mixins.spec.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
@include output(false) {
.test {
@include mixins.theme((
"primary": darkcyan,
"secondary": darkorange
"primary": #36454f,
"secondary": #353839
));
}
}

@include expect(false) {
.test {
--mg-color-primary: darkcyan;
--mg-color-secondary: darkorange;
--mg-color-primary: #36454f;
--mg-color-secondary: #353839;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/color/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
@use "../mixins";
@use "../variables";

$_custom-property-prefix: map.get(variables.$color, "prefix");
$_tokens: functions.create-theme-vars(map.get(variables.$color, "tokens"), $_custom-property-prefix);
$_custom-property-prefix: if(map.get(variables.$color, "prefix") == null, "color", map.get(variables.$color, "prefix"));
$_tokens: map.get(variables.$color, "tokens");
$_tokens: functions.create-theme-vars($_tokens, $_custom-property-prefix);

///
/// Generates user-provided theme's tokens for the color component management with tokens validation.
Expand Down

0 comments on commit 54a1ef7

Please sign in to comment.