Created
February 19, 2014 19:18
-
-
Save joshmedeski/9099487 to your computer and use it in GitHub Desktop.
GENERATE SAFE TEXT COLORS WITH SASS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit goes to Benjamin Charity
http://blog.benjamincharity.com/generate-safe-text-colors-with-sass/