Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Created September 23, 2015 21:51
Show Gist options
  • Save lcaballero/8891f4720ba0c1716fd4 to your computer and use it in GitHub Desktop.
Save lcaballero/8891f4720ba0c1716fd4 to your computer and use it in GitHub Desktop.
Stylus example of iterating over a hash
colors = {
green: #38ab0b
red: #ab130b
blue: #099aab
}
for name, color in colors
.btn-{name}
background: mix(color, white, 60%)
&:hover
background: color
@StevenRadig
Copy link

Thank you!

@jrvaja
Copy link

jrvaja commented Oct 1, 2017

That's great!

What about this?

colors = {
  red: {
    50: { bg: $red.lighten-5, clr: #FFF },
    100: { bg: $red.lighten-4, clr: #FFF },
  }
}

expecting outout:
md-red-50
md-red-100

@narkissbv
Copy link

Do you have an answer on your question from Oct 1, 2017? I'm looking for such a solution myself...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment