translating a color name to RGB triplet

Stephen Barncard stephenREVOLUTION at barncard.com
Sat Sep 9 13:57:08 EDT 2006


Ok, test done.

These internal functions don't even agree with each other. AND they 
don't show up in a standalone.  Many of the color names don't come 
back the same.

Verdict: Use the colornames for official names, but make up your own 
array or conversion table for any translation, i.e. the Eric Chatonet 
method. The internal calls are not reliable. I wouldn't bother with 
trying to pull it from rev libraries. The array method will also 
return empty if the color name isn't found, not a guess.

note the discrepancies below:

Name from 
colornames(),revColorToNumber(colorname),revNumberToColor(RGBtriad 
from revColorToNumber)

Aquamarine3 = 102,205,170 = MediumAquamarine
Azure1 = 239,255,255 = Azure
Chartreuse1 = 127,255,0 = Chartreuse
Chocolate4 = 126,49,23 = SaddleBrown
Coral1 = 247,101,65 = Coral
CornSilk1 = 255,247,215 = CornSilk
DarkOrange1 = 248,114,23 = Chocolate1
DarkOrange2 = 229,103,23 = Chocolate2
DarkOrange3 = 195,86,23 = Chocolate3
DarkOrange4 = 126,49,23 = SaddleBrown
DarkSalmon = 225,139,107 = Salmon
Firebrick3 = 193,27,23 = Red3
Firebrick4 = 126,5,23 = Brown4
Gray0 = 0,0,0 = Black
Gray1 = 21,5,23 = Transparent
Gray10 = 21,5,23 = Transparent
Gray100 = 255,255,255 = White
Gray11 = 21,5,23 = Transparent
Gray12 = 21,5,23 = Transparent
Gray13 = 21,5,23 = Transparent
Gray14 = 21,5,23 = Transparent
Gray15 = 21,5,23 = Transparent
Gray16 = 21,5,23 = Transparent
Gray17 = 21,5,23 = Transparent
Gray19 = 37,5,23 = Gray18
Gray2 = 21,5,23 = Transparent
Gray20 = 37,5,23 = Gray18
Gray22 = 43,27,23 = Gray21
Gray3 = 21,5,23 = Transparent
Gray33 = 70,62,65 = DimGray
Gray66 = 160,159,157 = LightGray
Gray9 = 21,5,23 = Transparent
Gray96 = 244,244,243 = WhiteSmoke
IndianRed4 = 126,34,23 = Tomato4
Ivory1 = 255,255,238 = Ivory
LightCyan1 = 224,255,255 = LightCyan
Magenta4 = 125,27,126 = DarkOrchid
NavyBlue = 0,0,128 = Navy
OrangeRed4 = 126,5,23 = Brown4
PaleGreen2 = 144,238,144 = LightGreen
Red4 = 126,5,23 = Brown4
SeaGreen4 = 46,139,87 = SeaGreen
Tan3 = 197,119,38 = Peru
Tan4 = 127,72,23 = Orange4
Yellow1 = 255,255,0 = Yellow

sqb

>Mark-
>
>Saturday, September 9, 2006, 2:54:15 AM, you wrote:
>
>>  This appears to work in the IDE:
>
>>  put revNumberToColor("249,232,210")
>
>Interesting. I had no idea revNumberToColor() and revColorToNumber()
>existed... I can see why they're not documented, though...
>
>put revColorToNumber("squirrel")
>
>returns "AliceBlue,239,247"
>
>--
>-Mark Wieder
>  mwieder at ahsoftware.net

-- 
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -


More information about the Use-livecode mailing list