Overview

Colors can be specified in a few ways in CSS rules. Most commonly there are hash colors in the format #rrggbb. The rr value is a two-digit hexadecimal red value between 00 and FF;  gg is a two-digit green value; and bb is a two-digit blue value. If the two digits for red are the same, and the two digits for green are the same, and the two digits for blue are the same, then the value can be shortened to just #rgb (one color digit each). Then there is the rgb(r,g,b) function, where r, g, and b are decimal values between 0 and 255 corresponding to red, green, and blue values.  Finally, there are color names. No matter what color mode Ajax Minifier is in, if one of these color names is encountered in the source stylesheet, it will be converted to the appropriate hash color in the output if the name is longer than the hash color. The color name will only be used depending on the color mode setting.

Strict Colors

A number of color names are recognized by Ajax Minifier. By default for maximum browser compatibility, hash values are converted to color names only if the color name is shorter and the name is recognized by all major browsers. This is color strict mode, and is the default behavior.

Color Name Color Value Swatch
Aqua #0ff  
Black #000  
Blue #00f  
Fuchsia #f0f  
Gray #808080  
Green #008000  
Lime #0f0  
Maroon #800000  
Navy #000080  
Olive #808000  
Purple #800080  
Red #f00  
Silver #c0c0c0  
Teal #008080  
White #fff  
Yellow #ff0  

So for example, “red” (three bytes) can be used instead of “#f00” (four bytes), but “#ff0” will never be replaced with “yellow.”

 

Major Colors

Many major browsers also agree on an extended set of color names. If these names are to be specified in the output of Ajax Minifier, the color mode will need to be change to major mode via –colors:major. Again, the color name will only be output if it is smaller than the hash-value of the color.

Color Name Color Value Swatch
AliceBlue #f0f8ff  
AntiqueWhite #faebd7  
AquaMarine #7fffd4  
Azure #f0ffff  
Beige #f5f5dc  
Bisque #ffe4c4  
BlanchedAlmond #ffebcd  
BlueViolet #8a2be2  
Brown #a52a2a  
Burlywood #ded887  
CadetBlue #5f9ea0  
Chartreuse #7fff00  
Chocolate #d2691e  
Coral #ff7f50  
CornflowerBlue #6495ed  
Cornsilk #fff8dc  
Crimson #dc143c  
Cyan #0ff  
DarkBlue #00008b  
DarkCyan #008b8b  
DarkGoldenrod #b8860b  
DarkGray #a9a9a9  
DarkGreen #006400  
DarkKhaki #bdb76b  
DarkMagenta #8b008b  
DarkOliveGreen #556b2f  
DarkOrange #ff8c00  
DarkOrchid #9932cc  
DarkRed #8b0000  
DarkSalmon #e9967a  
DarkSeaGreen #8fbc8f  
DarkSlateBlue #483d8b  
DarkSlateGray #2f4f4f  
DarkTurquoise #00ced1  
DarkViolet #9400d3  
DeepPink #ff1493  
DeepSkyBlue #00bfff  
DimGray #696969  
DodgerBlue #1e90ff  
Firebrick #b22222  
FloralWhite #fffaf0  
ForestGreen #228b22  
Gainsboro #dcdcdc  
GhostWhite #f8f8ff  
Gold #ffd700  
Goldenrod #daa520  
GreenYellow #adff2f  
Honeydew #f0fff0  
HotPink #ff69b4  
IndianRed #cd5c5c  
Indigo #4b0082  
Ivory #fffff0  
Khaki #f0e68c  
Lavender #e6e6fa  
LavenderBlush #fff0f5  
LawnGreen #7cfc00  
LemonChiffon #fffacd  
LightBlue #add8e6  
LightCoral #f08080  
LightCyan #e0ffff  
LightGoldenrodYellow #fafad2  
LightGrey #d3d3d3  
LightGreen #90ee90  
LightPink #ffb6c1  
LightSalmon #ffa07a  
LightSeaGreen #20b2aa  
LightSkyBlue #87cefa  
LightSlateGray #778899  
LightSteelBlue #b0c4de  
LightYellow #ffffe0  
LimeGreen #32cd32  
Linen #faf0e6  
Magenta #f0f  
MediumAquamarine #66cdaa  
MediumBlue #0000cd  
MediumOrchid #ba55d3  
MediumPurple #9370d8  
MediumSeaGreen #3cb371  
MediumSlateBlue #7b68ee  
MediumSpringGreen #00fa9a  
MediumTurquoise #48d1cc  
MediumVioletRed #c71585  
MidnightBlue #191970  
MintCream #f5fffa  
MistyRose #ffe4e1  
Moccasin #ffe4b5  
NavajoWhite #ffdead  
OldLace #fdf5e6  
OliveDrab #6b8e23  
Orange #ffa500  
OrangeRed #ff4500  
Orchid #da70d6  
PaleGoldenrod #eee8aa  
PaleGreen #98fb98  
PaleTurquoise #afeeee  
PaleVioletRed #d87093  
PapayaWhip #ffefd5  
PeachPuff #ffdab9  
Peru #cd853f  
Pink #ffc0cb  
Plum #dda0dd  
PowderBlue #b0e0e6  
RosyBrown #bc8f8f  
RoyalBlue #4169e1  
SaddleBrown #8b4513  
Salmon #fa8072  
SandyBrown #f4a460  
SeaGreen #2e8b57  
SeaShell #fff5ee  
Sienna #a0522d  
SkyBlue #87ceeb  
SlateBlue #6a5acd  
SlateGray #708090  
Snow #fffafa  
SpringGreen #00ff7f  
SteelBlue #4682b4  
Tan #d2b48c  
Thistle #d8bfd8  
Tomato #ff6347  
Turquoise #40e0d0  
Violet #ee82ee  
Wheat #f5deb3  
WhiteSmoke #f5f5f5  
YellowGreen #9acd32  

Hex Colors

When the color mode is set to hex (-colors:hex), none of the above color names will be used in the output; they will always be converted to the corresponding hex color. Unknown color names – those not in these tables – will be left unchanged.

Last edited Jun 19, 2011 at 6:42 AM by ronlo, version 7

Comments

No comments yet.