Planet3D Help ← planet3d.nl

Color Conversion

 

There are many ways of representing color values.
Probably the most popular in computer graphics is to assign a numeric value
to each of three different colors of light which can be displayed by a traditional cathode ray tube
such as that of a standard color television. These values for red, green, and blue can also be
expressed in several different ways but always represent a
level of intensity within the range from
none of that color component to the highest brightness available for it.

The
RWX Color command
uses a floating-point decimal range from 0 to 1 for each component,
and action commands used by Active Worlds builders expect either a
pre-defined color name
or a string of six characters made up of a
two digit integer hexadecimal number in the range from 00 to FF for each
of the three components.
You may also find while setting colors within various dialog boxes that an integer decimal range from 0 to 255 is often used.
The first table on this page lists the
pre-defined colors
that can be used with some of
the action commands along with conversions to the three types of RGB representations just mentioned.

Color Name=RWXDecimal IntegerHexadecimal
aquamarine#.439 .858 .576red=112 green=219 blue=14770DB93
black#0 0 0red=0 green=0 blue=0000000
blue#0 0 1red=0 green=0 blue=2550000FF
brass#.709 .65 .258red=181 green=166 blue=66B5A642
bronze#.549 .47 .325red=140 green=120 blue=838C7853
brown#.65 .164 .164red=166 green=42 blue=42A62A2A
copper#.72 .45 .2red=184 green=115 blue=51B87333
cyan#0 1 1red=0 green=255 blue=25500FFFF
darkgrey#.188 .188 .188red=48 green=48 blue=48303030
forestgreen#.137 .556 .137red=35 green=142 blue=35238E23
gold#.803 .498 .196red=205 green=127 blue=50CD7F32
green#0 1 0red=0 green=255 blue=000FF00
grey#.439 .439 .439red=112 green=112 blue=112707070
lightgrey#.75 .75 .75red=192 green=192 blue=192C0C0C0
magenta#1 0 1red=255 green=0 blue=255FF00FF
maroon#.556 .137 .419red=142 green=35 blue=1078E236B
navyblue#.137 .137 .556red=35 green=35 blue=14223238E
orange#1 .498 0red=255 green=127 blue=0FF7F00
orangered#1 .14 0red=255 green=36 blue=0FF2400
orchid#.858 .439 .858red=219 green=112 blue=219DB70DB
pink#1 .43 .78red=255 green=110 blue=199FF6EC7
red#1 0 0red=255 green=0 blue=0FF0000
salmon#.435 .258 .258red=111 green=66 blue=666F4242
scarlet#.549 .09 .09red=140 green=23 blue=238C1717
silver#.9 .909 .98red=230 green=232 blue=250E6E8FA
skyblue#.196 .6 .8red=50 green=153 blue=2043299CC
tan#.858 .576 .439red=219 green=147 blue=112DB9370
teal#0 .439 .439red=0 green=112 blue=112007070
turquoise#.678 .917 .917red=173 green=234 blue=234ADEAEA
violet#.309 .184 .309red=79 green=47 blue=794F2F4F
white#1 1 1red=255 green=255 blue=255FFFFFF
yellow#1 1 0red=255 green=255 blue=0FFFF00

Click the
#
link on any of the color samples to find
more colors
of the same hue.

Numeric conversion

For those who find hexadecimal numbers less than intuitive, the following two tables are provided.
One table lists exact integer conversions from a range of decimal numbers to their hexadecimal equivalents.
The other table lists conversions from a range of hexadecimal values to
approximate floating-point decimal equivalents based on the division of the integer by the decimal value 255.

Here is the decimal to hexadecimal conversion chart.

RangeHexadecimal Conversion
0 - 1500 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
16 - 3110 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
32 - 4720 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
48 - 6330 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
64 - 7940 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
80 - 9550 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
96 - 11160 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
112 - 12770 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
128 - 14380 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
144 - 15990 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
160 - 175A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
176 - 191B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
192 - 207C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
208 - 223D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
224 - 239E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
240 - 255F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF

Here is the hexadecimal to floating-point conversion chart based on dividing the integer value by decimal 255.
Values listed in this chart are rounded leaving enough precision to represent a clear distinction between values
for efficient use with the
RWX Color command.

RangeFloating-Point Decimal Conversion
00-070 .003 .007 .01   .015 .019 .02 .027
08-0F.03 .035 .039 .04   .047 .05 .054 .058
10-17.06 .066 .07 .074   .078 .08 .086 .09
18-1F.094 .098 .1 .105   .109 .11 .117 .12
20-27.125 .129 .13 .137   .14 .145 .149 .15
28-2F.156 .16 .164 .168   .17 .176 .18 .184
30-37.188 .19 .196 .2   .203 .207 .21 .215
38-3F.219 .22 .227 .23   .235 .239 .24 .247
40-47.25 .254 .258 .26   .266 .27 .274 .278
48-4F.28 .286 .29 .294   .298 .3 .305 .309
50-57.31 .317 .32 .325   .329 .33 .337 .34
58-5F.345 .349 .35 .356   .36 .364 .368 .37
60-67.376 .38 .384 .388   .39 .396 .4 .403
68-6F.407 .41 .415 .419   .42 .427 .43 .435
70-77.439 .44 .447 .45   .454 .458 .46 .466
78-7F.47 .474 .478 .48   .486 .49 .494 .498
80-87.5 .505 .509 .51   .517 .52 .525 .529
88-8F.53 .537 .54 .545   .549 .55 .556 .56
90-97.564 .568 .57 .576   .58 .584 .588 .59
98-9F.596 .6 .603 .607   .61 .615 .619 .62
A0-A7.627 .63 .635 .639   .64 .647 .65 .654
A8-AF.658 .66 .666 .67   .674 .678 .68 .686
B0-B7.69 .694 .698 .7   .705 .709 .71 .717
B8-BF.72 .725 .729 .73   .737 .74 .745 .749
C0-C7.75 .756 .76 .764   .768 .77 .776 .78
C8-CF.784 .788 .79 .796   .8 .803 .807 .81
D0-D7.815 .819 .82 .827   .83 .835 .839 .84
D8-DF.847 .85 .854 .858   .86 .866 .87 .874
E0-E7.878 .88 .886 .89   .894 .898 .9 .905
E8-EF.909 .91 .917 .92   .925 .929 .93 .937
F0-F7.94 .945 .949 .95   .956 .96 .964 .968
F8-FF.97 .976 .98 .984   .988 .99 .996 1

You may notice that the hexadecimal representation is much more concise,
which is exactly what makes it so popular.