Equivalence of Color names to RGB

MisterX b.xavier at internet.lu
Sun Jul 4 03:12:12 EDT 2004


Actually, setting the templatefield's backcolor might
be faster than having to create a control!

darn, good thing I tried... 

It returns the colorname... Anyone got an idea?


> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of J. Landman
> Gay
> Sent: Sunday, July 04, 2004 08:29
> To: How to use Revolution
> Subject: Re: Equivalence of Color names to RGB
> 
> 
> On 7/3/04 10:01 PM, Alejandro Tejada wrote:
> 
> > Hi developers,
> > 
> > I've almost finished a handler to export
> > vector graphics from RR/MC to Adobe Ilustrator
> > version 7 file format, but i need a table
> > of equivalences between rgb and the color names,
> > for example: AliceBlue = 239,247,255.
> > 
> > How could i convert the color names to their
> > equivalent rgb triplet?
> 
> Wilhelm Sanke posted the following a long time ago. I hope he doesn't 
> mind my re-posting it here, or the fact that I have changed his original 
> command handler to a function:
> 
> function colorToRGB which
>    set the backcolor of fld "hiddenfield" to which
>    get the effective backPixel of fld "hiddenfield"
>    set the backPixel of field "Hiddenfield" to it
>    return the  backcolor of fld "Hiddenfield"
> end colorToRGB
> 
> You can use a hidden field if you don't want the conversion to show. If 
> you are just doing this once during development, then you can use any 
> object, hidden or not. Go through the colorNames() and apply the 
> function to each one.
> 
> I thought this was a very clever script; setting the backpixel forces 
> the color name to its equivalent RGB value.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution


More information about the use-livecode mailing list