Skip to content

Instantly share code, notes, and snippets.

@bogdansoare
Forked from ntassone/loop.scss
Created July 19, 2014 09:58
Show Gist options
  • Save bogdansoare/242d3155c389d3c98cda to your computer and use it in GitHub Desktop.
Save bogdansoare/242d3155c389d3c98cda to your computer and use it in GitHub Desktop.
//Set Variables
$button-white: #ffffff;
$button-green: #44ca00;
$button-green-dark: #369a12;
$button-blue: #a6d1f9;
$button-blue-dark: #14283e;
$button-gray: #eeeeee;
$button-red: #9e0b0f;
//Create Array
$button-colors: (green $button-green white,
darkgreen $button-green-dark white,
blue $button-blue white,
darkblue $button-blue-dark white,
gray $button-gray #999,
red $button-red white
);
//Each loop to create classes
.button {
@each $type in $button-colors {
&.#{nth($type, 1)} {
background-color: #{nth($type, 2)};
color: #{nth($type, 3)};
&:hover {
background-color: darken(nth($type, 2), 5%);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment