translating a color name to RGB triplet

Ken Ray kray at sonsothunder.com
Sat Sep 9 14:38:57 EDT 2006


On 9/9/06 12:34 PM, "Stephen Barncard" <stephenREVOLUTION at barncard.com>
wrote:

> Somehow the thread has been lost.
> 
> The colornames does not give a list of the color RGB triad, just the
> names themselves. In the user-accessible, documented Rev world, there
> is no way shown to CONVERT from color name to RGB triad and
> vice-versa. This is what I was looking for.

Actually there is one that is documented (per se), that I suggested earlier,
but it is not "user-accessible" (meaning you can't search for 'convert color
name to RGB' in the Rev docs and find it):

You need to have a graphic object (like a square) and then execute this (I
called my graphic "ColorHolder"):

function getRGB pColorName
      put the long id of grc "ColorHolder" into tObj
      set the backColor of tObj to pColorName
      set the backPixel of tObj to (the effective backPixel of tObj)
      return (the backColor of tObj)
end getRGB

Basically if you set the color of a graphic object to the color name, you
can then retrieve the color value of the color.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list