Skip to content

Instantly share code, notes, and snippets.

@michaelpumo
Last active September 27, 2019 15:44
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/5a1ae5ba59add358d67997a135a469e1 to your computer and use it in GitHub Desktop.
Save michaelpumo/5a1ae5ba59add358d67997a135a469e1 to your computer and use it in GitHub Desktop.
Looping SCSS Map Colours
// ----
// 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');
}
.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