Skip to content

Instantly share code, notes, and snippets.

@morningtoast
Created March 6, 2017 19:34
Show Gist options
  • Save morningtoast/91447f5ba1c5400dcf6d3fc98478918d to your computer and use it in GitHub Desktop.
Save morningtoast/91447f5ba1c5400dcf6d3fc98478918d to your computer and use it in GitHub Desktop.
Sass looping for variables
// Color options
$grad_names: "green" "fuchsia" "teal" "purple" "orange"; // Name to used as modifier
$color_p: $color-green $color-fuchsia $color-teal $color-purple $color-orange; // Dark color
$color_s: $color-green-dark $color-fuchsia-dark $color-teal-dark $color-purple-dark $color-orange-dark; // Light color
@for $i from 1 through length($grad_names) {
$gn: nth($grad_names, $i);
$cp: nth($color_p, $i);
$cs: nth($color_s, $i);
.nw-menu-wicons--#{$gn} {
.accordion-title {
&:hover, &:focus {
background: tint($cp,90%);
}
}
.nw-menu-wicons__menuicon svg {
fill:$cs;
}
.tabs-title a {
color:$cs;
}
.tabs-title > a[aria-selected='true']:before {
background-color: tint($cp,90%);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment