Formula to determine brightness of RGB color

前端 未结 20 3112
猫巷女王i
猫巷女王i 2020-11-21 23:16

I\'m looking for some kind of formula or algorithm to determine the brightness of a color given the RGB values. I know it can\'t be as simple as adding the RGB values toget

20条回答
  •  长发绾君心
    2020-11-21 23:39

    RGB Luminance value = 0.3 R + 0.59 G + 0.11 B

    http://www.scantips.com/lumin.html

    If you're looking for how close to white the color is you can use Euclidean Distance from (255, 255, 255)

    I think RGB color space is perceptively non-uniform with respect to the L2 euclidian distance. Uniform spaces include CIE LAB and LUV.

提交回复
热议问题