Skip to content

Instantly share code, notes, and snippets.

@RyanRoberts
Last active December 15, 2015 22:19
Show Gist options
  • Save RyanRoberts/5332692 to your computer and use it in GitHub Desktop.
Save RyanRoberts/5332692 to your computer and use it in GitHub Desktop.
Colour Palette Function based on Stuart Robson's Mixin http://alwaystwisted.com/post.php?s=2013-04-07-sassifaction-in-colour-palette-mixins
@function colorize($color, $change: n) {
@if $change == l1 {
@return tint($color, 10%);
}
@else if $change == l2 {
@return tint($color, 25%);
}
@else if $change == l3 {
@return tint($color, 50%);
}
@else if $change == l4 {
@return tint($color, 75%);
}
@else if $change == d1 {
@return shade($color, 10%);
}
@else if $change == d2 {
@return shade($color, 25%);
}
@else if $change == d3 {
@return shade($color, 50%);
}
@else if $change == d4 {
@return shade($color, 75%);
}
@else {
@return ($color)
}
}
@RyanRoberts
Copy link
Author

SCSS usage:

body {
color: colorize($baseColor,l4);
background: colorize(#fff,d2);
border: 1px solid colorize($borderColor,d3);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment