[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: color widget

Pavel A. Romashkin writes:

> David made fun of my little hack I put out a while ago, which was doing
> exactly that, and promised something sleeker and cooler and of course
> object-filled from his own anvil. You better ask the Coyote where it is.
> Cheers,
> Pavel
> Marc Schellens wrote:
> > 
> > I want to let the user interactively select a color.
> > Is there some modal dialog, which allows that comfortably
> > and returns a three byte vector?
> > Ie. I am using object graphics, so there might be problems
> > with cw_colorsel and co.
> > 
> > Thanks,
> > :-) marc

My news source seems to be dropping every third
article these days, so I didn't see this article
from Marc Schellens. (Perhaps this is a message 
from the gods that I should play more tennis.)

But I've got all *kinds* of color tools! 

I recommend FSC_COLOR. Out of the box, this 
program knows 88 color "names" that I use for
all manner of drawing colors. (If you don't
like the 88 I've selected for you, you can
easily load your own in the program.) It will
instinctively return a color triple on a 24-bit
display device, but you can force it to *always*
return the color triple by setting the TRIPLE

   IDL> Print, FSC_COLOR('yellow', /Triple)
	255 255 0

If you want the user to see the colors and select
one from the available colors, then simple use the

   IDL> theColor = FSC_COLOR('Indian Red', $
           /SelectColor, /Triple)

Specifying a group leader, will make the program

    theColor = FSC_COLOR('Indian Red', $
        /SelectColor, /Triple, Group_Leader=event.top)

I use this program in every widget program I write,
whether object graphics or direct graphics. I don't
know how anyone lives without it. :-)

You will need the PICKCOLORNAME program too:




David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155