You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using isDark() or isLight() fails to discern light or dark colours.
These are based on getBrightness()
getBrightness calls private function _fixRGB pRGB
private function _fixRGB pRGB returns text triplet
getBrigthness pRGB expects an array but calls _fixRGB which returns a triplet!
So then in getBrightness fails because tRBG is a text triplet, but getBrightness uses this as an array: return (tRGB["r"]* 299 + tRGB["g"]* 587 + tRGB["b"]* 114) / 1000
The text was updated successfully, but these errors were encountered:
stam66
changed the title
isDark returns true regardless of color passed
isDark() returns true regardless of color passed
Mar 6, 2022
in addition to the above issue which is easily solvable, the other issue is that isDark() takes a parameter but does not pass this parameter to getBrightness(), which itself can either take a parameter or this can be empty, in which case the sColor provides the RBG values.
This means that whatever value isDark(pRGB) is called with is irrelevant, it will always return a result for getBrightness(sColor). isLight() is defined as not isDark() and doesn't even take a parameter to pass.
using isDark() or isLight() fails to discern light or dark colours.
These are based on getBrightness()
getBrightness calls private function _fixRGB pRGB
private function _fixRGB pRGB returns text triplet
getBrigthness pRGB expects an array but calls _fixRGB which returns a triplet!
So then in getBrightness fails because tRBG is a text triplet, but getBrightness uses this as an array:
return (tRGB["r"]* 299 + tRGB["g"]* 587 + tRGB["b"]* 114) / 1000
The text was updated successfully, but these errors were encountered: