From e811ffeba1d3566e2ff121291f7c704401c5f609 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 20 Oct 2024 11:12:54 +0200 Subject: Allow removing of theme variants in config --- src/_core.vars.scss | 60 +++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/_core.vars.scss b/src/_core.vars.scss index 83d3a6a..85aec23 100644 --- a/src/_core.vars.scss +++ b/src/_core.vars.scss @@ -129,44 +129,46 @@ $themes: (); @each $theme-name, $theme in config.$themes { @each $variant-name, $variant in $theme { - $compiled: props.def(--colors); + @if $variant != null { + $compiled: props.def(--colors); - @each $palette-name, $palette in $-static-colors { - $compiled: props.merge($compiled, ( #{$palette-name}-static: $palette )); - } + @each $palette-name, $palette in $-static-colors { + $compiled: props.merge($compiled, ( #{$palette-name}-static: $palette )); + } - @each $palette-name, $palette in map.get($variant, --palettes) { - $base-color: list.nth($palette, 1); - $contrasts: list.nth($palette, 2); - $ranges: list.nth($palette, 3); + @each $palette-name, $palette in map.get($variant, --palettes) { + $base-color: list.nth($palette, 1); + $contrasts: list.nth($palette, 2); + $ranges: list.nth($palette, 3); - $palette: fn.palette($base-color, map.get($variant, --contrasts, $contrasts), map.get($variant, --ranges, $ranges), list.nth(map.get($variant, --palettes, --base), 1)); - $compiled: props.merge($compiled, ( $palette-name: $palette )); - } - - @each $color, $value in map.get($variant, --constants) { - $compiled: props.merge($compiled, ( $color: $value )); - } + $palette: fn.palette($base-color, map.get($variant, --contrasts, $contrasts), map.get($variant, --ranges, $ranges), list.nth(map.get($variant, --palettes, --base), 1)); + $compiled: props.merge($compiled, ( $palette-name: $palette )); + } - @each $color, $ref in map.get($variant, --semantic) { - $res: (); + @each $color, $value in map.get($variant, --constants) { + $compiled: props.merge($compiled, ( $color: $value )); + } - @if meta.type-of($ref) == 'map' { - @each $key, $r in $ref { - $re1: list.nth($r, 1); - $re2: iro.fn-list-slice($r, 2); - $res: map.merge($res, ($key: props.get($compiled, $re1, $re2...))); + @each $color, $ref in map.get($variant, --semantic) { + $res: (); + + @if meta.type-of($ref) == 'map' { + @each $key, $r in $ref { + $re1: list.nth($r, 1); + $re2: iro.fn-list-slice($r, 2); + $res: map.merge($res, ($key: props.get($compiled, $re1, $re2...))); + } + } @else { + $ref1: list.nth($ref, 1); + $ref2: iro.fn-list-slice($ref, 2); + $res: props.get($compiled, $ref1, $ref2...); } - } @else { - $ref1: list.nth($ref, 1); - $ref2: iro.fn-list-slice($ref, 2); - $res: props.get($compiled, $ref1, $ref2...); + + $compiled: props.merge($compiled, ( $color: $res )); } - $compiled: props.merge($compiled, ( $color: $res )); + $themes: map.set($themes, $theme-name, $variant-name, $compiled); } - - $themes: map.set($themes, $theme-name, $variant-name, $compiled); } } -- cgit v1.2.3-70-g09d2