Return CSS var by default and add palette-of function for raw value

This commit is contained in:
Matthias Metelka 2022-08-31 21:19:53 +02:00
parent 1498ba2c29
commit cd726049a1
2 changed files with 10 additions and 7 deletions

View file

@ -26,7 +26,7 @@
@return $map; @return $map;
} }
@function get-var-from-map($map, $keyword, $theme, $keys: ()) { @function get-value-from-map($map, $keyword, $theme, $keys: ()) {
$i: str-index($keyword, "-"); $i: str-index($keyword, "-");
@if $i { @if $i {

View file

@ -174,14 +174,17 @@ $vars: (
), ),
); );
@function color($keyword, $theme: default) { @function color($keyword) {
$colors: map.get($vars, colors); @return var(--#{$keyword});
@return get-var-from-map($colors, $keyword, $theme);
} }
@function prop($keyword, $theme: default) { @function palette-of($keyword, $theme: default) {
$props: map.get($vars, props); $colors: map.get($vars, colors);
@return get-var-from-map($props, $keyword, $theme); @return get-value-from-map($colors, $keyword, $theme);
}
@function prop($keyword) {
@return var(--#{$keyword});
} }
:root { :root {