Skip to content

Instantly share code, notes, and snippets.

@BuddyLReno
Created April 16, 2014 13:15
Show Gist options
  • Save BuddyLReno/10873062 to your computer and use it in GitHub Desktop.
Save BuddyLReno/10873062 to your computer and use it in GitHub Desktop.
Color Switcher with Sass Maps
<div class="Brand sc">
<h4>Pop</h4>
<h3 class="popBrand">Force Pop</h3>
<h4 class="unpopBrand">UnPop</h4>
</div>
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
$brandColorMap: (
bgp: #F74812,
sc: #B3752A
);
@mixin brandColoring ($colorMap: $brandColorMap) {
@each $brand, $color in $colorMap {
.Brand.#{$brand} {
h4:not(.unpopBrand), .popBrand {
color: $color;
}
}
}
}
//USAGE
@include brandColoring($brandColorMap);
.Brand.bgp h4:not(.unpopBrand), .Brand.bgp .popBrand {
color: #f74812;
}
.Brand.sc h4:not(.unpopBrand), .Brand.sc .popBrand {
color: #b3752a;
}
<div class="Brand sc">
<h4>Pop</h4>
<h3 class="popBrand">Force Pop</h3>
<h4 class="unpopBrand">UnPop</h4>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment