Skip to content

Instantly share code, notes, and snippets.

@shaneriley
Last active August 29, 2015 14:00
Show Gist options
  • Save shaneriley/11237389 to your computer and use it in GitHub Desktop.
Save shaneriley/11237389 to your computer and use it in GitHub Desktop.
Color iteration in Stylus? Nope.
// Only one of the strings in the list of colors gets interpolated, thanks
// to Stylus converting the color keywords to hex values.
// Thanks, Stylus!
li
for color in red pink orange yellow green blue purple brown black shit
&.{color}
background: color
// What I had to do instead to make it work. Note that simply wrapping the
// values in quotes and leaving them inline in the for loop does not work.
li
classes = "red", "pink", "orange", "yellow", "green", "blue", "purple", "brown", "black"
for color in classes
&.{color}
background: unquote(color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment