Skip to content

Instantly share code, notes, and snippets.

@michaelpumo
Last active July 19, 2017 12:43
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 michaelpumo/56d5ad7f2e7a8bb3fbf794337e62dcaa to your computer and use it in GitHub Desktop.
Save michaelpumo/56d5ad7f2e7a8bb3fbf794337e62dcaa to your computer and use it in GitHub Desktop.
Contextual SCSS theming mixin
$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