Created
June 12, 2015 11:48
-
-
Save thealscott/d54314c92b7b5aaf839a to your computer and use it in GitHub Desktop.
Assign random colors from an array
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: $color-vivid-red,$color-vivid-red-medium,$color-vivid-red-dark, | |
$color-dark-blue,$color-dark-blue-medium,$color-dark-blue-dark, | |
$color-moderate-blue,$color-moderate-blue-medium,$color-moderate-blue-light, | |
$color-vivid-orange,$color-vivid-orange-medium,$color-vivid-orange-light; | |
$colors-length: length($colors); | |
background-color: nth($colors, random($colors-length)); | |
@for $i from 1 through 4 { | |
&:nth-child(n + #{$i}) { | |
background-color:nth($colors, random($colors-length)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment