Skip to content

Instantly share code, notes, and snippets.

@teles
Created May 28, 2015 17:47
Show Gist options
  • Save teles/01abe3b0158a3600cd24 to your computer and use it in GitHub Desktop.
Save teles/01abe3b0158a3600cd24 to your computer and use it in GitHub Desktop.
Background stripes mixin source code.
@mixin background-stripes($stripes-colors...) {
$stripes-list: ();
@for $i from 1 through length($stripes-colors){
$stripe-number-prev: #{100%/length($stripes-colors) * ($i - 1)};
$stripe-number: #{100%/length($stripes-colors) * $i};
$stripe-color: nth($stripes-colors, $i);
$stripe-declaration-prev: $stripe-color $stripe-number-prev;
$stripe-declaration: $stripe-color $stripe-number;
$stripes-list: append($stripes-list, $stripe-declaration-prev, comma);
$stripes-list: append($stripes-list, $stripe-declaration, comma);
}
background-image: linear-gradient(to right, $stripes-list);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment