我正在使用以下方法在Javascript中计算亮度:
luminosity = (5036060 * backgroundColor.red + 9886846 * backgroundColor.green + 1920103 * backgroundColor.blue) >> 24;
对于颜色是白色的情况,即3个RGB值均为255,我得到的结果是-1。我进行了显式测试,在Javascript中,值“ 4294967295 >> 24”为-1。
为什么?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句