HTML and JavaScript allow colors to be specified for such things as
text color, link color, document background, and even the background
of table cells. Colors can be specified in a fully general
#RRGGBB format, in which
RR, GG, and
BB are each two hexadecimal digits which
represent the intensity of red, green, and blue primaries in the
color. Two hexadecimal digits provide 8 color values, or 256
possible levels for each of the red, green, and blue primaries.
Using the color specification scheme, you would use "#000000" for
black and "#FFFFFF" for white. "#00FF00" would produce a very intense
green, and "#A0A0A0" would produce a gray color.
Because it can be difficult to determine the hexadecimal values for
the colors you desire, HTML and JavaScript also allow certain colors
to be specified by name. The HTML 3.2 standard defines sixteen
standard color names that should be supported by all conforming
browsers. These colors are listed in Table G.1. This list of sixteen colors
was chosen to match the 16 colors supported on old VGA display
hardware. Note that the HTML 3.2 standard does not specify the
actual color values for each of these named colors, so they may be
displayed somewhat differently by different browsers.
Navigator 2.0 and 3.0 and Internet Explorer 3.0 each support all of the
standard colors listed in Table G.1.
In addition to these standard colors, Navigator also recognizes quite
a few other color names, which are listed in Table G.2. Because these color names
are not standardized in any way,[1]
it is not really a good idea to rely on them in production web pages
that may be viewed on web browsers that do not support these color
names. For that reason, Table G.2
also lists the hexadecimal color string equivalents for each of
these colors. If you use the color name while developing a
JavaScript program, you can replace it with the corresponding color
value for the release version of that program.
Table G.2: Colors
Color Name
Color Value
Color Name
Color Value
aliceblue
#F0F8FF
lightsalmon
#FFA07A
antiquewhite
#FAEBD7
lightseagreen
#20B2AA
aqua
#00FFFF
lightskyblue
#87CEFA
aquamarine
#7FFFD4
lightslategray
#778899
azure
#F0FFFF
lightsteelblue
#B0C4DE
beige
#F5F5DC
lightyellow
#FFFFE0
bisque
#FFE4C4
lime
#00FF00
black
#000000
limegreen
#32CD32
blanchedalmond
#FFEBCD
linen
#FAF0E6
blue
#0000FF
magenta
#FF00FF
blueviolet
#8A2BE2
maroon
#800000
brown
#A52A2A
mediumaquamarine
#66CDAA
burlywood
#DEB887
mediumblue
#0000CD
cadetblue
#5F9EA0
mediumorchid
#BA55D3
chartreuse
#7FFF00
mediumpurple
#9370DB
chocolate
#D2691E
mediumseagreen
#3CB371
coral
#FF7F50
mediumslateblue
#7B68EE
cornflowerblue
#6495ED
mediumspringgreen
#00FA9A
cornsilk
#FFF8DC
mediumturquoise
#48D1CC
crimson
#DC143C
mediumvioletred
#C71585
cyan
#00FFFF
midnightblue
#191970
darkblue
#00008B
mintcream
#F5FFFA
darkcyan
#008B8B
mistyrose
#FFE4E1
darkgoldenrod
#B8860B
moccasin
#FFE4B5
darkgray
#A9A9A9
navajowhite
#FFDEAD
darkgreen
#006400
navy
#000080
darkkhaki
#BDB76B
oldlace
#FDF5E6
darkmagenta
#8B008B
olive
#808000
darkolivegreen
#556B2F
olivedrab
#6B8E23
darkorange
#FF8C00
orange
#FFA500
darkorchid
#9932CC
orangered
#FF4500
darkred
#8B0000
orchid
#DA70D6
darksalmon
#E9967A
palegoldenrod
#EEE8AA
darkseagreen
#8FBC8F
palegreen
#98FB98
darkslateblue
#483D8B
paleturquoise
#AFEEEE
darkslategray
#2F4F4F
palevioletred
#DB7093
darkturquoise
#00CED1
papayawhip
#FFEFD5
darkviolet
#9400D3
peachpuff
#FFDAB9
deeppink
#FF1493
peru
#CD853F
deepskyblue
#00BFFF
pink
#FFC0CB
dimgray
#696969
plum
#DDA0DD
dodgerblue
#1E90FF
powderblue
#B0E0E6
firebrick
#B22222
purple
#800080
floralwhite
#FFFAF0
red
#FF0000
forestgreen
#228B22
rosybrown
#BC8F8F
fuchsia
#FF00FF
royalblue
#4169E1
gainsboro
#DCDCDC
saddlebrown
#8B4513
ghostwhite
#F8F8FF
salmon
#FA8072
gold
#FFD700
sandybrown
#F4A460
goldenrod
#DAA520
seagreen
#2E8B57
gray
#808080
seashell
#FFF5EE
green
#008000
sienna
#A0522D
greenyellow
#ADFF2F
silver
#C0C0C0
honeydew
#F0FFF0
skyblue
#87CEEB
hotpink
#FF69B4
slateblue
#6A5ACD
indianred
#CD5C5C
slategray
#708090
indigo
#4B0082
snow
#FFFAFA
ivory
#FFFFF0
springgreen
#00FF7F
khaki
#F0E68C
steelblue
#4682B4
lavender
#E6E6FA
tan
#D2B48C
lavenderblush
#FFF0F5
teal
#008080
lawngreen
#7CFC00
thistle
#D8BFD8
lemonchiffon
#FFFACD
tomato
#FF6347
lightblue
#ADD8E6
turquoise
#40E0D0
lightcoral
#F08080
violet
#EE82EE
lightcyan
#E0FFFF
wheat
#F5DEB3
lightgoldenrodyellow
#FAFAD2
white
#FFFFFF
lightgreen
#90EE90
whitesmoke
#F5F5F5
lightgrey
#D3D3D3
yellow
#FFFF00
lightpink
#FFB6C1
yellowgreen
#9ACD32
.