check presence for cssobject isColorDark inquery
This commit is contained in:
@@ -19,7 +19,7 @@ App.CssObject.reopenClass
|
|||||||
[r, g, b]
|
[r, g, b]
|
||||||
|
|
||||||
isColorDark: (rgb_hex)->
|
isColorDark: (rgb_hex)->
|
||||||
return false unless rbg_hex.match /#[0-9a-zA-Z]{6}/
|
return false unless rgb_hex and rbg_hex.match /#[0-9a-zA-Z]{6}/
|
||||||
[r, g, b] = @rgb_to_numeric(rgb_hex)
|
[r, g, b] = @rgb_to_numeric(rgb_hex)
|
||||||
luma = 0.2126 * r + 0.7152 * g + 0.0722 * b # per ITU-R BT.709
|
luma = 0.2126 * r + 0.7152 * g + 0.0722 * b # per ITU-R BT.709
|
||||||
luma < 40
|
luma < 40
|
||||||
|
|||||||
Reference in New Issue
Block a user