Skip to content

Instantly share code, notes, and snippets.

@krabello
Created October 3, 2014 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krabello/e83688371d2b226ebc77 to your computer and use it in GitHub Desktop.
Save krabello/e83688371d2b226ebc77 to your computer and use it in GitHub Desktop.
Dynamically change text color based on background color
/*
Usage: color: set-text-color($colorVar);
*/
@function set-text-color($color) {
@if (lightness($color) > 50) {
@return darken($color, 40%); // lighter bg
} @else {
@return lighten($color, 40%); // darker bg
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment