Skip to content

Instantly share code, notes, and snippets.

@wehrhaus
Created July 15, 2014 21:51
Show Gist options
  • Save wehrhaus/4081a1c59625ccebcc51 to your computer and use it in GitHub Desktop.
Save wehrhaus/4081a1c59625ccebcc51 to your computer and use it in GitHub Desktop.
Stylus Triangle Generator
triangle(orientation, width, height, color)
if orientation == top
border-width 0 unit(width/2, px) unit(height, px) unit(width/2, px)
border-color transparent transparent color transparent
else if orientation == left
border-width unit(height/2, px) unit(width, px) unit(height/2, px) 0
border-color transparent color transparent transparent
else if orientation == bottom
border-width unit(height, px) unit(width/2, px) 0 unit(width/2, px)
border-color color transparent transparent transparent
else if orientation == right
border-width unit(height/2, px) 0 unit(height/2, px) unit(width, px)
border-color transparent transparent transparent color
else
error('triangle mixin expected an orientation of top/right/bottom/left')
width 0
height 0
border-style solid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment