-1

For example i have 2 colors (ARGB) class Color.

My idea is to divide them on light and dark color. So in the bitmap later, I will replace lighter color with white, darker color with black. So how to compare ?

I think RGB average value is not a real solution. Thanks.

Lucas
  • 3,376
  • 6
  • 31
  • 46
Alexander
  • 431
  • 2
  • 5
  • 19
  • maybe already answered here http://stackoverflow.com/questions/9018016/how-to-compare-two-colors – MichaC Oct 01 '13 at 10:38

1 Answers1

1

The RGB is not the good way to compare the lightness of a color. You should convert your RGB to HSL (Hue, Saturation, Lightness) and then you'll have the amount of light of the color in the Lightness component.

For this conversion you can take a look to RGB to HSL and back, calculation problems

Community
  • 1
  • 1
jseijas
  • 126
  • 1
  • 4