Skip to content

Commit e2e6ca6

Browse files
author
AMJones
committed
Replaces isLight function.
1 parent a33fd13 commit e2e6ca6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

scss/_colors-functions.scss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@
125125

126126
// region ////////////////////////////////////////////// Other Color Functions
127127

128-
@function isLight($color) {
128+
@function isLight($color, $threshold: 150) {
129129
@if quote($color) == "transparent" {
130130
@return true;
131-
} @else if (lightness($color) > 50) {
132-
@return true;
133131
} @else {
134-
@return false;
132+
$red: red($color);
133+
$green: green($color);
134+
$blue: blue($color);
135+
$yiq: (($red*299)+($green*587)+($blue*114))/1000;
136+
137+
@return if($yiq >= $threshold, true, false);
135138
}
136139
}
137140

0 commit comments

Comments
 (0)