Last active
August 29, 2015 14:00
-
-
Save shaneriley/11237389 to your computer and use it in GitHub Desktop.
Color iteration in Stylus? Nope.
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
// 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