Last active
July 19, 2017 12:43
-
-
Save michaelpumo/56d5ad7f2e7a8bb3fbf794337e62dcaa to your computer and use it in GitHub Desktop.
Contextual SCSS theming mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$brand: ( | |
'turquoise': #5C9AB1, | |
'red': #FF495C, | |
'green': #6ECB98, | |
'yellow': #FFC700, | |
'orange': #FF6B00, | |
'blue': #009BDE, | |
'purple': #A35EB5 | |
); | |
@mixin themes($properties) { | |
@each $name, $value in $brand { | |
.is-theme-#{$name} & { | |
@each $property in $properties { | |
#{$property}: $value; | |
} | |
} | |
} | |
} | |
// Usage: | |
/* | |
.my-class { | |
@include themes(background-color border-color); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment