Skip to content

Instantly share code, notes, and snippets.

@joshmedeski
Created February 19, 2014 19:18
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 joshmedeski/9099487 to your computer and use it in GitHub Desktop.
Save joshmedeski/9099487 to your computer and use it in GitHub Desktop.
GENERATE SAFE TEXT COLORS WITH SASS
$lightness-bound : 70 !global;
$hue-bound-bottom : 40 !global;
$hue-bound-top : 200 !global;
@function checkDangerZone($color) {
@if ( (lightness($color) > $lightness-bound) or (hue($color) > $hue-bound-bottom and hue($color) < $hue-bound-top )) {
@return darken(desaturate($color, 70), 60);
}
@else {
@return lighten(desaturate($color, 50), 60);
}
}
@joshmedeski
Copy link
Author

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