From 50f6acc739f24bfa2ca080d08e90d82f8fa83543 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 17 Oct 2024 16:45:00 +0200 Subject: Revamped variable management --- src_old/objects/_palette.scss | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src_old/objects/_palette.scss (limited to 'src_old/objects/_palette.scss') diff --git a/src_old/objects/_palette.scss b/src_old/objects/_palette.scss new file mode 100644 index 0000000..19f282f --- /dev/null +++ b/src_old/objects/_palette.scss @@ -0,0 +1,62 @@ +@use 'sass:map'; +@use 'sass:list'; +@use 'sass:string'; +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; +@use '../config'; + +@include iro.props-namespace('palette') { + @include iro.bem-object(iro.props-namespace()) { + display: flex; + block-size: 3em; + + @include iro.bem-elem('item') { + flex: 1 1 auto; + + $palette: map.get(config.$themes, config.$theme-default, --palettes, --base); + $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); + + @for $i from 1 through list.length($contrasts) { + $key: list.nth(map.keys($contrasts), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(--base $key); + } + } + } + + @each $palette-name, $palette in map.get(config.$themes, config.$theme-default, --palettes) { + $contrasts: map.get(config.$themes, config.$theme-default, --contrasts, list.nth($palette, 2)); + + @include iro.bem-modifier(string.slice($palette-name, 3)) { + @include iro.bem-elem('item') { + @for $i from 1 through list.length($contrasts) { + $key: list.nth(map.keys($contrasts), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color($palette-name $key); + } + } + } + } + } + + @include iro.bem-modifier('static') { + @each $palette-name, $palette in map.get(config.$static-colors, --palettes) { + $contrasts: map.get(config.$static-colors, --contrasts); + + @include iro.bem-modifier(string.slice($palette-name, 3)) { + @include iro.bem-elem('item') { + @for $i from 1 through list.length($contrasts) { + $key: list.nth(map.keys($contrasts), $i); + + &:nth-child(#{$i}) { + background-color: fn.global-color(#{$palette-name}-static $key); + } + } + } + } + } + } + } +} -- cgit v1.2.3-70-g09d2