We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a33fd13 commit e2e6ca6Copy full SHA for e2e6ca6
1 file changed
scss/_colors-functions.scss
@@ -125,13 +125,16 @@
125
126
// region ////////////////////////////////////////////// Other Color Functions
127
128
-@function isLight($color) {
+@function isLight($color, $threshold: 150) {
129
@if quote($color) == "transparent" {
130
@return true;
131
- } @else if (lightness($color) > 50) {
132
- @return true;
133
} @else {
134
- @return false;
+ $red: red($color);
+ $green: green($color);
+ $blue: blue($color);
135
+ $yiq: (($red*299)+($green*587)+($blue*114))/1000;
136
+
137
+ @return if($yiq >= $threshold, true, false);
138
}
139
140
0 commit comments