Here is a table that shows all the named colors recognized by modern browsers and X11 systems. The name is printed in both black and white to help you decide which font color to choose.
AliceBlue | AliceBlue |
AntiqueWhite | AntiqueWhite |
Aqua | Aqua |
Aquamarine | Aquamarine |
Azure | Azure |
Beige | Beige |
Bisque | Bisque |
Black | Black |
BlanchedAlmond | BlanchedAlmond |
Blue | Blue |
BlueViolet | BlueViolet |
Brown | Brown |
BurlyWood | BurlyWood |
CadetBlue | CadetBlue |
Chartreuse | Chartreuse |
Chocolate | Chocolate |
Coral | Coral |
CornflowerBlue | CornflowerBlue |
Cornsilk | Cornsilk |
Crimson | Crimson |
Cyan | Cyan |
DarkBlue | DarkBlue |
DarkCyan | DarkCyan |
DarkGoldenrod | DarkGoldenrod |
DarkGray | DarkGray |
DarkGreen | DarkGreen |
DarkKhaki | DarkKhaki |
DarkMagenta | DarkMagenta |
DarkOliveGreen | DarkOliveGreen |
DarkOrange | DarkOrange |
DarkOrchid | DarkOrchid |
DarkRed | DarkRed |
DarkSalmon | DarkSalmon |
DarkSeaGreen | DarkSeaGreen |
DarkSlateBlue | DarkSlateBlue |
DarkSlateGray | DarkSlateGray |
DarkTurquoise | DarkTurquoise |
DarkViolet | DarkViolet |
DeepPink | DeepPink |
DeepSkyBlue | DeepSkyBlue |
DimGray | DimGray |
DodgerBlue | DodgerBlue |
FireBrick | FireBrick |
FloralWhite | FloralWhite |
ForestGreen | ForestGreen |
Fuchsia | Fuchsia |
Gainsboro | Gainsboro |
GhostWhite | GhostWhite |
Gold | Gold |
Goldenrod | Goldenrod |
Gray | Gray |
Green | Green |
GreenYellow | GreenYellow |
Honeydew | Honeydew |
HotPink | HotPink |
IndianRed | IndianRed |
Indigo | Indigo |
Ivory | Ivory |
Khaki | Khaki |
Lavender | Lavender |
LavenderBlush | LavenderBlush |
LawnGreen | LawnGreen |
LemonChiffon | LemonChiffon |
LightBlue | LightBlue |
LightCoral | LightCoral |
LightCyan | LightCyan |
LightGoldenrodYellow | LightGoldenrodYellow |
LightGreen | LightGreen |
LightGrey | LightGrey |
LightPink | LightPink |
LightSalmon | LightSalmon |
LightSeaGreen | LightSeaGreen |
LightSkyBlue | LightSkyBlue |
LightSlateGray | LightSlateGray |
LightSteelBlue | LightSteelBlue |
LightYellow | LightYellow |
Lime | Lime |
LimeGreen | LimeGreen |
Linen | Linen |
Magenta | Magenta |
Maroon | Maroon |
MediumAquamarine | MediumAquamarine |
MediumBlue | MediumBlue |
MediumOrchid | MediumOrchid |
MediumPurple | MediumPurple |
MediumSeaGreen | MediumSeaGreen |
MediumSlateBlue | MediumSlateBlue |
MediumSpringGreen | MediumSpringGreen |
MediumTurquoise | MediumTurquoise |
MediumVioletRed | MediumVioletRed |
MidnightBlue | MidnightBlue |
MistyRose | MistyRose |
Moccasin | Moccasin |
NavajoWhite | NavajoWhite |
Navy | Navy |
OldLace | OldLace |
Olive | Olive |
OliveDrab | OliveDrab |
Orange | Orange |
OrangeRed | OrangeRed |
Orchid | Orchid |
PaleGoldenrod | PaleGoldenrod |
PaleGreen | PaleGreen |
PaleTurquoise | PaleTurquoise |
PaleVioletRed | PaleVioletRed |
PapayaWhip | PapayaWhip |
PeachPuff | PeachPuff |
Peru | Peru |
Pink | Pink |
Plum | Plum |
PowderBlue | PowderBlue |
Purple | Purple |
Red | Red |
RosyBrown | RosyBrown |
RoyalBlue | RoyalBlue |
SaddleBrown | SaddleBrown |
Salmon | Salmon |
SandyBrown | SandyBrown |
SeaGreen | SeaGreen |
Seashell | Seashell |
Sienna | Sienna |
Silver | Silver |
SkyBlue | SkyBlue |
SlateBlue | SlateBlue |
SlateGray | SlateGray |
Snow | Snow |
SpringGreen | SpringGreen |
SteelBlue | SteelBlue |
Tan | Tan |
Teal | Teal |
Thistle | Thistle |
Tomato | Tomato |
Turquoise | Turquoise |
Violet | Violet |
Wheat | Wheat |
White | White |
WhiteSmoke | WhiteSmoke |
Yellow | Yellow |
YellowGreen | YellowGreen |
Colors.pl[]
The table above was written by a simple perl script called colors.pl and a plain text file that lists all 139 named colors, each on its own line with no spaces:
AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk Crimson Cyan DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HotPink IndianRed Indigo Ivory Khaki Lavender LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed MidnightBlue MistyRose Moccasin NavajoWhite Navy OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple Red RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen Seashell Sienna Silver SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise Violet Wheat White WhiteSmoke Yellow YellowGreen
If you want to play with these colors, copy the list and save it in your working directory as NamedColors.txt
Now, in that same directory, make a new file called colors.pl or whatever you like. Start with the usual opening line:
#!/usr/bin/perl -w
The -w switch tells your compiler to warn you of errors in your syntax.
# colors.pl - a simple script for handling named colors.
It's nice to add the script's filename and a brief description of what it does.
open (COLORS, "NamedColors.txt") or die; @Colors=<COLORS>; close COLORS;
We open (read-only) the bare list of NamedColors and slurp it into an array, @Colors. We do this via a filehandle called <COLORS>. Then we close the unaltered file.
Now we use a foreach loop statement to break each $color out of @Colors and wrap it in wiki syntax for tables, stuffing each color into a new array, @NamedColors:
foreach $color (@Colors) { chomp$color; @NamedColors=("@NamedColors", "\n|- style=\"background:$color\"", "\n|style=\"color:black\"|$color", "\n|style=\"color:white\"|$color") }
Notice that the "s (double quotes) for the style attributes in the wiki syntax must be escaped with \s (backslashes).
The colors.pl script produces wiki table syntax foreach color appending @NamedColors with:
|- style="background:AliceBlue" |style="color:black"|AliceBlue |style="color:white"|AliceBlue
When the loop has iterated the whole list, we now use a new file handle COLORTABLE to hold and print the newly composed table rows and cells:
open (COLORTABLE, ">ColorTable.txt") or die; print {COLORTABLE} "@NamedColors"; close COLORTABLE;
The open statement this time is write-enabled (>). The colors.pl script has now created a new file in your working directory – ColorTable.txt
You can add a little confirmation message at the end:
print "\n A file: ColorTable.txt has been written to your working directory\n";
To run the script make sure you have NamedColors.txt in your current working directory - the same directory from which you run colors.pl. In a terminal, you type: perl colors.pl
Now you can open ColorTable.txt and enclose it with <tt> and </tt>. Once you get the hang of it, you can make all sorts of nifty tools for manipulating colors with wiki syntax and perl scripts.
Your turn[]
Too advanced? See Scripting. Too simple? See POE or help with CPAN!
Problems, questions, ideas, comments? Let us know!