Created
April 25, 2016 06:03
-
-
Save jbrz0/9e4e5e4af9effb6987a35d88ec5d750d to your computer and use it in GitHub Desktop.
Define a multi-colored theme in your Sass stylesheet
This file contains 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
//Create the mixin for theme colors | |
@mixin theme($name, $color) { | |
// Define colors in your theme | |
$primary: $color; | |
$secondary: lighten(adjust-hue($color, 20), 10%); | |
// Add your classes with css colors added | |
.#{$name} { | |
.element { | |
color: $primary; | |
} | |
.other-element { | |
background: $secondary; | |
} | |
} | |
} | |
// Using the theme | |
@include theme(theme-banana, yellow); | |
// Output | |
.theme-banana .element { | |
color: yellow; | |
} | |
.theme-banana .other-element { | |
background: #bbff33; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment