Last active
September 27, 2019 15:44
-
-
Save michaelpumo/5a1ae5ba59add358d67997a135a469e1 to your computer and use it in GitHub Desktop.
Looping SCSS Map Colours
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
// ---- | |
// Sass (v3.4.25) | |
// Compass (v1.0.3) | |
// ---- | |
$colours: ( | |
'green': #00da80, | |
'pink': #fad1e3, | |
'yellow': #fbee46, | |
'red': #ed1c24, | |
'blue': #5162ee | |
); | |
.classy { | |
width: 100%; | |
@each $name, $colour in $colours { | |
&--#{$name} { | |
color: $colour; | |
} | |
} | |
} | |
.single { | |
color: map-get($colours, 'red'); | |
} |
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
.classy { | |
width: 100%; | |
} | |
.classy--green { | |
color: #00da80; | |
} | |
.classy--pink { | |
color: #fad1e3; | |
} | |
.classy--yellow { | |
color: #fbee46; | |
} | |
.classy--red { | |
color: #ed1c24; | |
} | |
.classy--blue { | |
color: #5162ee; | |
} | |
.single { | |
color: #ed1c24; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment