Skip to content

Instantly share code, notes, and snippets.

@Beyondcow
Created March 14, 2014 19:55
Show Gist options
  • Save Beyondcow/9555530 to your computer and use it in GitHub Desktop.
Save Beyondcow/9555530 to your computer and use it in GitHub Desktop.
Less Color Functions
/*
http://www.hongkiat.com/blog/less-color-functions/
LESS provides several functions with quite descriptive keywords that we can use to manipulate colors: lighten(), darken(), saturate(), desaturate(), fadein(), fadeout(), fade() spin() and mix().
*/
@color: #5ea1d5;
@colorDark: darken(@color, 20%);
.box.darken {
background-color: @color;
border: 3px solid darken(@color, 20%);
}
.box.lighten {
border: 3px solid lighten(@color, 20%);
}
.box.darken {
background-color: @color;
border: 3px solid @colorDark;
}
.box.hue {
background-color: spin(@color, 123);
}
.box.desaturate {
background-color: desaturate(spin(@color, 123), 50%);
}
.box.mix {
background-color: mix(@blue, @yellow, 50%);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment