Skip to content

Instantly share code, notes, and snippets.

@CrocoDillon
Created November 21, 2013 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CrocoDillon/7580601 to your computer and use it in GitHub Desktop.
Save CrocoDillon/7580601 to your computer and use it in GitHub Desktop.
Creates guides, useful for prototyping.
$guides-default-color: #4e68c7;
$guides-default-orientation: horizontal;
/**
* Creates guides, useful for prototyping.
*
* @param $guide-sets List of guides, which can be numbers (uses default
* color and orientation) or lists in the form (color orientation guides),
* where guides can be a single number or a list of numbers.
*/
@mixin guides($guide-sets) {
$colors: ();
$positions: ();
$sizes: ();
@each $guide-set in $guide-sets {
@if type_of($guide-set) == number {
$guide-set: $guides-default-color $guides-default-orientation $guide-set;
}
$color: linear-gradient(0deg, nth($guide-set, 1), nth($guide-set, 1));
$position: ();
$size: ();
@each $guide in nth($guide-set, 3) {
@if nth($guide-set, 2) == horizontal {
$position: 0 $guide;
$size: 100% 1px;
}
@else {
$position: $guide 0;
$size: 1px 100%;
}
$colors: append($colors, $color, comma);
$positions: append($positions, $position, comma);
$sizes: append($sizes, $size, comma);
}
};
background-repeat: no-repeat;
background-image: $colors;
background-position: $positions;
background-size: $sizes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment