On Feb 22, 10:35 pm, "Joe" <jbassk...@noemail.noemailwrote:
I have an array of colors and I would like to sort this array from dark to
light. What is the easiest way to do this?
Thanks,
Joe
Colors are represented usually by 3 or 4 values (Red, Green, Blue) or
(Red, Green, Blue, Alpha). You cannot sort colours from 'dark' to
'light', but through the rainbow, like all the hues.
Consider this:
List<ColormyColors = new List<Color>();
for (int r = 0; r < 256; r ++)
for (int g = 0; g < 256; g ++)
for int (b = 0; b < 256; b ++)
myColors.Add (new Color (r,g,b))
That would give you a pretty good sorted array of colours. Of course
there are other ways to sort colours, but I'm sure you can figure it
out when you break them down into their RGB components.