Skip to content

Instantly share code, notes, and snippets.

@jaromero
Created February 5, 2016 18:56
Show Gist options
  • Save jaromero/2be19cc1bc56db429dc6 to your computer and use it in GitHub Desktop.
Save jaromero/2be19cc1bc56db429dc6 to your computer and use it in GitHub Desktop.
Checkerboard background pattern mixin
@mixin checkerboard ($c1, $c2, $sx, $sy) {
// Usage:
// @include checkerboard(<color 1>, <color 2>, <cell width>, <cell height>);
$sx2: ($sx * 2);
$sy2: ($sy * 2);
background: {
color: $c1;
image: linear-gradient(to bottom right, $c2 25%, transparent 25%, transparent 75%, $c2 75%, $c2),
linear-gradient(to bottom right, $c2 25%, transparent 25%, transparent 75%, $c2 75%, $c2);
position: 0 0, $sx $sy;
size: $sx2 $sy2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment