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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Credit goes to Benjamin Charity
http://blog.benjamincharity.com/generate-safe-text-colors-with-sass/