Last active
December 17, 2015 06:09
-
-
Save allusis/671f6df3c134ab5e0cbd to your computer and use it in GitHub Desktop.
A Sass function for determine contrasting colors
This file contains hidden or 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
$text-color: #555; | |
@function contrast-color($color) { | |
@if (lightness($color) > 75) { | |
// Lighter background, return dark color | |
@return $text-color; | |
} @else { | |
// Darker background, return light color | |
@return white; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment