I’ve looked for this formula, on average, once a year for the past five or so years. It’s useful for determining what colour text to display over a colour: if y > 0.5, display white; otherwise, display black.
Hopefully by posting it here, I’ll be able to find it a bit easier next time.
// y = luminance
// r, g and b = the red, green and blue components of
// a colour
y = 0.3r + 0.59g + 0.11b
Converting a color to grayscale
Published: Monday, 27th October 2008 at 11:22 PM
By day, he works for ABC TV as a web developer. By night, he plays bass guitar in Look Who's Toxic. He also runs a little Unix Timestamp conversion site. There are plenty of other things he should be doing, but most of the time he's dreaming of what he'll do when he grows up while watching bad Star Trek spin-offs.