sass-site/source/assets/sass/components/_pop-stripe.scss

36 lines
1.0 KiB
SCSS
Raw Normal View History

2023-01-12 20:54:24 +01:00
@use 'sass:math';
@use 'sass:list';
@use 'sass:meta';
@use '../functions';
@use '../config/color/brand';
2023-01-12 19:19:42 +01:00
2023-03-03 23:46:50 +01:00
$sl-colors: var(--sl-color--hopbush) var(--sl-color--bouquet)
var(--sl-color--venus) var(--sl-color--patina) var(--sl-color--nebula)
var(--sl-color--white) var(--sl-color--dawn-pink) var(--sl-color--wafer)
var(--sl-color--iron) var(--sl-color--regent-grey) var(--sl-color--pale-sky)
var(--sl-color--midnight-blue);
2023-01-06 22:40:29 +01:00
@function stripes($position, $sl-colors) {
2023-01-09 20:10:02 +01:00
$sl-colors: if(
2023-01-12 19:19:42 +01:00
meta.type-of($sl-colors) != 'list',
2023-01-09 20:10:02 +01:00
compact($sl-colors),
$sl-colors
);
2023-01-12 19:19:42 +01:00
$gradient: ();
$width: math.div(100%, list.length($sl-colors));
2023-01-06 22:40:29 +01:00
2023-01-12 19:19:42 +01:00
@for $i from 1 through list.length($sl-colors) {
$pop: list.nth($sl-colors, $i);
2023-01-09 20:10:02 +01:00
$new: $pop ($width * ($i - 1)), $pop ($width * $i);
2023-01-12 19:19:42 +01:00
$gradient: list.join($gradient, $new, comma);
2023-01-06 22:40:29 +01:00
}
@return linear-gradient($position, $gradient);
}
.sl-c-pop-stripe {
2023-01-12 19:19:42 +01:00
height: functions.sl-px-to-rem(4px);
2023-01-06 22:40:29 +01:00
background-image: stripes((to right), ($sl-colors));
background-size: 100%;
}