1

When you read this title you might automatically think of luminescence, but that's not what I'm after.

What I want is to have you current color and have it wait on a scale from black to white.

So something like this Color Scale, and then I would like the current color returned as a percentage of how black or white that color is.

Maarten
  • 635
  • 1
  • 9
  • 29
  • already answered here : http://stackoverflow.com/questions/687261/converting-rgb-to-grayscale-intensity – mcamier Apr 11 '14 at 13:38

2 Answers2

3

There are different algorithms for converting colors to grayscales. This is an explanation of an algorithm, the Wikipedia article on Grayscale might also lead you to useful ressources.

The implementation you finally choose highly depends on your use case.

LionC
  • 3,106
  • 1
  • 22
  • 31
0

What I was looking for was far simpler I kept over thinking this.

Basically just get RGB then get the highest color.

Then do int ColorIntensity = (color / 255) * 100; and that's basically your color intensity in percentage.

Maarten
  • 635
  • 1
  • 9
  • 29