Created
April 26, 2017 12:01
-
-
Save Chrissi2812/d5c7ac87fc08d02c9949312168346066 to your computer and use it in GitHub Desktop.
Sass Auto Text Color
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
//YIQ Implementation | |
@function yiq($color) { | |
$red : red($color); | |
$green: green($color); | |
$blue : blue($color); | |
@return (($red*.299)+($green*.587)+($blue*.114)); | |
} | |
@function color-contrast($background, $dark:#000, $light:#fff) { | |
@if yiq($background) >= 128 { | |
@return $dark; | |
} @else { | |
@return $light; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment