@charset "UTF-8";

@mixin background-stripes(
  $color: null,
  $thickness: 1em,
  $rotation: -45deg,
  $image: null
) {
  $validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
  $get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
  @if not $color {
    $color: rgba(0, 0, 0, 0.1);
    background-image: repeating-linear-gradient(
        $validate-unit,
        $color 0,
        $color $thickness,
        transparent $thickness,
        transparent $thickness * 2
      ) + $get-image;
    @if $image {
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;
    }
  } @else if length($color) == 1 {
    background-image: repeating-linear-gradient(
        $validate-unit,
        $color 0,
        $color $thickness,
        transparent $thickness,
        transparent $thickness * 2
      ) + $get-image;
    @if $image {
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;
    }
  } @else if length($color) > 1 {
    $list: ();
    @for $i from 1 through length($color) {
      $index-color: nth($color, $i);
      $style-rule: $index-color ($thickness * $i) - $thickness, $index-color $thickness * $i;
      $list: append($list, $style-rule, comma);
    }
    background-image: repeating-linear-gradient($validate-unit, $list) + $get-image;
    @if $image {
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;
    }
  }
}
