UNPKG
@hackplan/polaris
Version:
latest (4.1.9)
4.1.9
4.1.8
4.1.7
4.1.6
4.1.5
4.1.4
4.1.3
4.1.2
4.1.1
4.1.0
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0
Shopify’s product component library
github.com/Shopify/polaris-react
Shopify/polaris-react
@hackplan/polaris
/
esnext
/
utilities
/
color-validation.js
9 lines
(8 loc)
•
272 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
// implements: https://www.w3.org/WAI/ER/WD-AERT/#color-contrast
export
function
isLight
(
{ red, green, blue }
) {
const
contrast = (red *
299
+ green *
587
+ blue *
114
) /
1000
;
return
contrast >
125
; }
export
function
isDark
(
color
) {
return
!
isLight
(color); }