Skip to content

Instantly share code, notes, and snippets.

@thealscott
Created June 12, 2015 11:48
Show Gist options
  • Save thealscott/d54314c92b7b5aaf839a to your computer and use it in GitHub Desktop.
Save thealscott/d54314c92b7b5aaf839a to your computer and use it in GitHub Desktop.
Assign random colors from an array
$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