diff options
author | Volpeon <git@volpeon.ink> | 2024-10-20 11:12:54 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-10-20 11:12:54 +0200 |
commit | e811ffeba1d3566e2ff121291f7c704401c5f609 (patch) | |
tree | 52fc53382cd3e8e0e3e7f8c02bc70a11ecbb9c96 | |
parent | Update (diff) | |
download | iro-design-e811ffeba1d3566e2ff121291f7c704401c5f609.tar.gz iro-design-e811ffeba1d3566e2ff121291f7c704401c5f609.tar.bz2 iro-design-e811ffeba1d3566e2ff121291f7c704401c5f609.zip |
Allow removing of theme variants in config
-rw-r--r-- | src/_core.vars.scss | 60 |
1 files changed, 31 insertions, 29 deletions
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: (); | |||
129 | 129 | ||
130 | @each $theme-name, $theme in config.$themes { | 130 | @each $theme-name, $theme in config.$themes { |
131 | @each $variant-name, $variant in $theme { | 131 | @each $variant-name, $variant in $theme { |
132 | $compiled: props.def(--colors); | 132 | @if $variant != null { |
133 | $compiled: props.def(--colors); | ||
133 | 134 | ||
134 | @each $palette-name, $palette in $-static-colors { | 135 | @each $palette-name, $palette in $-static-colors { |
135 | $compiled: props.merge($compiled, ( #{$palette-name}-static: $palette )); | 136 | $compiled: props.merge($compiled, ( #{$palette-name}-static: $palette )); |
136 | } | 137 | } |
137 | 138 | ||
138 | @each $palette-name, $palette in map.get($variant, --palettes) { | 139 | @each $palette-name, $palette in map.get($variant, --palettes) { |
139 | $base-color: list.nth($palette, 1); | 140 | $base-color: list.nth($palette, 1); |
140 | $contrasts: list.nth($palette, 2); | 141 | $contrasts: list.nth($palette, 2); |
141 | $ranges: list.nth($palette, 3); | 142 | $ranges: list.nth($palette, 3); |
142 | 143 | ||
143 | $palette: fn.palette($base-color, map.get($variant, --contrasts, $contrasts), map.get($variant, --ranges, $ranges), list.nth(map.get($variant, --palettes, --base), 1)); | 144 | $palette: fn.palette($base-color, map.get($variant, --contrasts, $contrasts), map.get($variant, --ranges, $ranges), list.nth(map.get($variant, --palettes, --base), 1)); |
144 | $compiled: props.merge($compiled, ( $palette-name: $palette )); | 145 | $compiled: props.merge($compiled, ( $palette-name: $palette )); |
145 | } | 146 | } |
146 | |||
147 | @each $color, $value in map.get($variant, --constants) { | ||
148 | $compiled: props.merge($compiled, ( $color: $value )); | ||
149 | } | ||
150 | 147 | ||
151 | @each $color, $ref in map.get($variant, --semantic) { | 148 | @each $color, $value in map.get($variant, --constants) { |
152 | $res: (); | 149 | $compiled: props.merge($compiled, ( $color: $value )); |
150 | } | ||
153 | 151 | ||
154 | @if meta.type-of($ref) == 'map' { | 152 | @each $color, $ref in map.get($variant, --semantic) { |
155 | @each $key, $r in $ref { | 153 | $res: (); |
156 | $re1: list.nth($r, 1); | 154 | |
157 | $re2: iro.fn-list-slice($r, 2); | 155 | @if meta.type-of($ref) == 'map' { |
158 | $res: map.merge($res, ($key: props.get($compiled, $re1, $re2...))); | 156 | @each $key, $r in $ref { |
157 | $re1: list.nth($r, 1); | ||
158 | $re2: iro.fn-list-slice($r, 2); | ||
159 | $res: map.merge($res, ($key: props.get($compiled, $re1, $re2...))); | ||
160 | } | ||
161 | } @else { | ||
162 | $ref1: list.nth($ref, 1); | ||
163 | $ref2: iro.fn-list-slice($ref, 2); | ||
164 | $res: props.get($compiled, $ref1, $ref2...); | ||
159 | } | 165 | } |
160 | } @else { | 166 | |
161 | $ref1: list.nth($ref, 1); | 167 | $compiled: props.merge($compiled, ( $color: $res )); |
162 | $ref2: iro.fn-list-slice($ref, 2); | ||
163 | $res: props.get($compiled, $ref1, $ref2...); | ||
164 | } | 168 | } |
165 | 169 | ||
166 | $compiled: props.merge($compiled, ( $color: $res )); | 170 | $themes: map.set($themes, $theme-name, $variant-name, $compiled); |
167 | } | 171 | } |
168 | |||
169 | $themes: map.set($themes, $theme-name, $variant-name, $compiled); | ||
170 | } | 172 | } |
171 | } | 173 | } |
172 | 174 | ||