Last active
February 15, 2019 18:59
-
-
Save Netzberufler/1825432bc859cad336f7ba95291ccb4e to your computer and use it in GitHub Desktop.
Sass Mixins for Color Variables
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
// Text Color Mixin. | |
@mixin color($colorVar) { | |
color: map-get($themeColors, $colorVar); | |
color: var($colorVar); | |
} | |
// Background Color mixin. | |
@mixin backgroundColor($colorVar) { | |
background-color: map-get($themeColors, $colorVar); | |
background-color: var($colorVar); | |
} |
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
// Theme Colors. | |
$themeColors: ( | |
--primary-color : #006699, | |
--secondary-color : #0791b6, | |
--accent-color : #ddcc11, | |
); |
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
@import '_variables'; | |
@import '_mixins'; | |
// Usage. | |
a { | |
@include color(--primary-color); | |
} | |
// Output. | |
a { | |
color: #006699; | |
color: var(--primary-color); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment