Created
September 29, 2013 02:14
-
-
Save jackie/6748736 to your computer and use it in GitHub Desktop.
Recursively generates a striped gradient.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$colors: #b00b00 #bada55 #de1e7e #f0feaf #ac1d1c #e1e100 #facade; | |
$stops: (); | |
@function gradient($i: 0) { | |
@if $i == length($colors) { | |
@return $stops; | |
} | |
$i: $i + 1; | |
$new-stops: nth($colors, $i) percentage(($i - 1)/length($colors)), nth($colors, $i) percentage($i/length($colors)); | |
$stops: join( $stops, $new-stops, comma ); | |
@return gradient($i); | |
} | |
$stops: gradient(); | |
html { | |
@include background-image(linear-gradient( top center, $stops )); | |
height: 100px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment