Skip to content

Commit

Permalink
refactor!: change input parameter to rgb in array, add input check
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCodesThings committed Mar 12, 2024
1 parent 0c150d2 commit 999df0e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/rgbColorYIQValue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import looksLikeRGBA from '@chriscodesthings/color-looks-like-rgba';

export default function (r, g, b) {
return ((r * 299) + (g * 587) + (b * 114)) / 1000;

export default function (col) {
if (!looksLikeRGBA(col)) {
return;
}

return ((col[0] * 299) + (col[1] * 587) + (col[2] * 114)) / 1000;
}

0 comments on commit 999df0e

Please sign in to comment.