Formula to determine perceived brightness of RGB color

The method could vary depending on your needs. Here are 3 ways to calculate Luminance:

  • Luminance (standard for certain colour spaces): (0.2126*R + 0.7152*G + 0.0722*B) source
    img

  • Luminance (perceived option 1): (0.299*R + 0.587*G + 0.114*B) source
    img

  • Luminance (perceived option 2, slower to calculate): sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2 )sqrt( 0.299*R^2 + 0.587*G^2 + 0.114*B^2 ) (thanks to @MatthewHerbst) source
    img

[Edit: added examples using named css colors sorted with each method.]

Leave a Comment