On Apr 11, 2007, at 12:33 PM, 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...


You could try

dim v1 as Variant = Color1
dim v2 as Variant = Color2

SwapEm = (v1.IntegerValue > v2.IntegerValue)

It depends, of course, on how you want to sort them.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to