Skip to content

Instantly share code, notes, and snippets.

@colinmurphy
Created February 19, 2016 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinmurphy/27f0cfb61eac7b087125 to your computer and use it in GitHub Desktop.
Save colinmurphy/27f0cfb61eac7b087125 to your computer and use it in GitHub Desktop.
Loops in SASS
// =============================================
// Background and Colors
// =============================================
@mixin background($color, $value) {
.bg-#{$color} {
background: $value;
}
}
@mixin color($color, $value) {
.color-#{$color} {
color: $value;
}
.color-hover-#{$color} {
&:hover,
&:active,
&:focus {
color: $value;
}
}
}
$colors: (white : $white, black : $black, gray : $gray, gray-light : $gray-light, gray-dark: $gray-dark);
@each $color, $value in $colors {
@include background($color, $value);
@include color($color, $value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment