Last active
July 27, 2016 18:05
-
-
Save kellysutton/e4f849b599df194b5cfbd101e5f7cee8 to your computer and use it in GitHub Desktop.
Generating Color Utility Classes in SASS
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
$color-list { | |
red #f00, | |
green #0f0, | |
blue #00f | |
} | |
@each $value in $color-list { | |
.#{nth($value, 1)} { | |
color: nth($value, 2); | |
} | |
.bg-#{nth($value, 1)} { | |
background-color: nth($value, 2); | |
} | |
.border-#{nth($value, 1)} { | |
border-color: nth($value, 2); | |
} | |
} |
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
<h1 class="h1 bold blue sans-serif">Headline</h1> |
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
$white: #fff; | |
.white { | |
color: $white; | |
} | |
.bg-white { | |
background-color: $white; | |
} | |
.border-white { | |
border-color: $white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment