I think you first have to define what it means to 'sort colors' methinks! Colors (as a data type) don't have a 'natural' sort order; you'll have to impose one. Once you do that, sorting them should be like sorting an array of any other data type (especially if you encapsulate it in a class for re-use)
On Apr 11, 2007, at 11:33 AM, John McKernon wrote: > Dear friends, > > I've started a project where I need to sort a list of colors, by > color. At > first glance, it sounded easy, but it's proven to be anything but > simple. > > So far, sorting using HSV values seems to be best, but there are > odd gaps > and jumps, particularly when near-white values are involved. > Perhaps it's > just the limited display range of my monitor that's getting me > confused? > > Here's what I've been using to compare the colors: > > if Color1.Hue>Color2.Hue then > SwapEm=True > > elseif Color1.Hue=Color2.Hue then > > if Color1.Saturation<Color2.Saturation then > SwapEm=True > > elseif Color1.Saturation=Color2.Saturation then > > if Color1.Value>Color2.Value then > SwapEm=True > end if > end if > end if > > Does anyone have any other suggestions for how to tackle this? There's > nothing in the NUG archives, and even Google turned up pretty much > empty > handed. > > Hmmm... > > - John > > > _______________________________________________ > Unsubscribe or switch delivery mode: > <http://www.realsoftware.com/support/listmanager/> > > Search the archives: > <http://support.realsoftware.com/listarchives/lists.html> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
