Colornames to RGB values

Wilhelm Sanke sanke at
Wed Dec 4 16:28:01 EST 2002

On Wed, 4 Dec 2002 , "Monte Goulding" <monte at>

> libColor on my site can translate from any of
> colorName, RGB, hex, HSV to any of colorName, RGB, hex, HSV. You don't even
> need to know the type that you have. Just specify what you want to change it
> to.
> PS still looking for CMYK scripts if anyone has them.
> Cheers
> Monte
Dear Monte,

I really appreciate your "libcolor" stack  as a tool (along with the
other stacks you offer on your website), and I see from your script that
for converting colornames to RGB values you also make use of the
backpixel property.

Richard Gaskin's information that you can look up  the list of
colornames with their RGB equivalents is certainly also helpful
(although you have to dig deep into the custom properties). I repeat
here part of it for the context:

> If you want to find the complete list, open up the Application Overview
> and turn on Revolution UI stacks in list. Find revColors.rev and go to
> the only card in the only stack. Have a look at the properties and go
> to the Custom tab, then turn on "Show Revolution UI custom properties".
> The cRevColorTranslation property gives you all the names & RGB
> equivalents.
There are, of course, as we all may know, no problems to get RGB values
of a colorname using the color chooser of the Properties Dialog in
Metacard and the Revolution Color Dialog.

However, there are occasions when you want to change the whole or a part
of a color value "on the fly" during runtime (this is how I came across
this problem) without first looking up a colorname list or loading
another stack. Happily this can be done with these already mentioned 3
lines of script - without having stored a list of all colornames and
their equivalent RGB values somewhere:

" get the effective backPixel of control x  # the control that has a
colorname and therefore no

# retrievable RGB-backcolor
    set the backPixel of control x to it         # this eliminates the
colorname and replaces it  with RGB
  put the  backcolor of control x into anyColorVar # for further

You can even leave out here

"set the backcolor of control x to empty"

as a second line, which is used in the script of the Metacard Color

This possibility to convert colornames to RGB values by scripting  is
nowhere mentioned in the Revolution and Metacard documentations, as far
as I see.

For Revolution, it would be probably useful to add this information
to the "backpixel" and "colornames" entries of the "Transcript


Wilhelm Sanke

More information about the Use-livecode mailing list