本文介绍了如何确定亮度%?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 http://www.workwithcolor.com/color-luminance-2233。 HTM ,红色(#FF0000)具有亮度:54%。和浅粉色(#FF8080)具有亮度:89%。我们的设计师喜欢它,但它是如何确定的?试一下: http://www.workwithcolor.com/hsl-color-schemer- 01.htm

According to http://www.workwithcolor.com/color-luminance-2233.htm, RED (#FF0000) has Luminance: 54%. and light pink (#FF8080) has Luminance: 89%. Our designers like it but how is it determined? Try here: http://www.workwithcolor.com/hsl-color-schemer-01.htm

我试图用公布的W3C 相对亮度公式,虽然范围为[ 0,1],红色是 0.21 和白色是 1.00

I tried using relative luminance formula published by W3C and although the range is [0,1], red is 0.21 and white is 1.00.

我在想,也许什么workwithcolor确实是第一次变相的颜色为灰度,​​并宣读了灰色的亮度。我尝试过,但它仍然无法产生相同的结果。

I'm thinking, maybe what workwithcolor does is first covert the color into grayscale, and read the luminance of the gray. I tried it but it still doesn't give the same result.

我试过到目前为止: http://jsfiddle.net/HytZQ/

推荐答案

在这里查看公式:Formula确定RGB颜色亮度

Check the formula here:Formula to determine brightness of RGB color

Luminance (standard, objective): (0.2126*R) + (0.7152*G) + (0.0722*B)

把R = 255,G = B = 0,你会得到54

Put R=255, and G=B=0, you'll get 54

编辑:对相对亮度,除以最大值(255)你会得到21%

For relative luminance, divide by the maximum (255)you get 21%

有关白,你就会得到100%

For white, you get 100%

这篇关于如何确定亮度%?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 03:56