42 lines
1.0 KiB
SCSS
Raw Normal View History

2023-01-12 14:54:24 -05:00
@use 'sass:math';
@use 'sass:list';
@use 'sass:meta';
2023-03-13 15:02:47 -05:00
@use 'sass:map';
2023-01-12 14:54:24 -05:00
@use '../functions';
@use '../config/color/brand';
2023-01-12 12:19:42 -06:00
2023-03-13 15:02:47 -05:00
$sl-colors: ();
// loop over the variable names in config/color/brand.scss
@each $color-name in map.keys(meta.module-variables('brand')) {
// turn each sass variable name into a css var() function
$var: var(--#{$color-name});
// add each var() function to the space-separated list
$sl-colors: list.append($sl-colors, $var, space);
}
2023-01-06 16:40:29 -05:00
@function stripes($position, $sl-colors) {
2023-01-09 14:10:02 -05:00
$sl-colors: if(
2023-01-12 12:19:42 -06:00
meta.type-of($sl-colors) != 'list',
2023-01-09 14:10:02 -05:00
compact($sl-colors),
$sl-colors
);
2023-01-12 12:19:42 -06:00
$gradient: ();
$width: math.div(100%, list.length($sl-colors));
2023-01-06 16:40:29 -05:00
2023-01-12 12:19:42 -06:00
@for $i from 1 through list.length($sl-colors) {
$pop: list.nth($sl-colors, $i);
2023-01-09 14:10:02 -05:00
$new: $pop ($width * ($i - 1)), $pop ($width * $i);
2023-01-12 12:19:42 -06:00
$gradient: list.join($gradient, $new, comma);
2023-01-06 16:40:29 -05:00
}
@return linear-gradient($position, $gradient);
}
.sl-c-pop-stripe {
2023-01-12 12:19:42 -06:00
height: functions.sl-px-to-rem(4px);
2023-01-06 16:40:29 -05:00
background-image: stripes((to right), ($sl-colors));
background-size: 100%;
}