Color Basics

RGB Colors
Web Safe Colors
Predefined Colors
Working With Color

RGB Colors

To use colors appropriately on a web page requires that you know a little bit about RGB colors and how they are represented in a web page.

In the physical world colors are made up of a mixture of the three primary colors red, yellow, and blue. However computer monitors have to use the primary colors red, green, and blue instead. This limitation is due to the colors that can be generated by electron guns and the phosphors used on cathode ray tubes in the typical computer monitor. An RGB color therefore has a red component, a green component, and a blue component. Each component can have 256 shades and is represented by a number from 0 - 255. The color black (representing the absence of color) has an RGB value of 0, 0, 0. The color white (representing all colors) has an RGB value of 255, 255, 255. Using this system 16,777,216 different shades of color can be represented using RGB.

On a web page, RGB colors are represented using the hexadecimal numbering system rather than the decimal numbering system. The hex numbering system uses 16 digits instead of 10 digits. Those digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. A complete RGB value consists of 6 hex digits. Two digits for the red component, two digits for the green component, and two digits for the blue component. The color black would be 000000 in hex and the color white would be FFFFFF in hex. In HTML code, color values are preceded by the # symbol. As an example, the HTML color value #FF0000 would be a bright red color.

Top of page

Web Safe Colors

When web browsers with a graphical user interface (GUI) first came out most computer systems only had the capability of displaying 256 colors. Browsers were designed to display a so-called "browser safe" or "web safe" palette consisting of 216 colors. In order for your web page to display your color scheme correctly you had to stick to the "web safe" colors. If you specified an RGB color that was not "web safe" the browser would replace the color specified with the nearest "web safe" color.

"Web safe" colors always used the following pairs of hex values for the red, green, and blue components:

00
33
66
99
CC
FF

A combination of any of the pairs above for the RGB components is a "web safe" color. As an example, #3399CC is a "web safe" color, but #3399C9 is not. The following table displays the "web safe" palette more or less by hue.

FFFFFF CCCCCC 999999 666666 333333 000000 FFCC00 FF9900 FF6600 FF3300  
99CC00   CC9900 FFCC33 FFCC66 FF9966 FF6633 CC3300   CC0033
CCFF00 CCFF33 333300 666600 999900 CCCC00 FFFF00 CC9933 CC6633 330000 660000 990000 CC0000 FF0000 FF3366 FF0033
99FF00 CCFF66 99CC33 666633 999933 CCCC33 FFFF33 996600 993300 663333 993333 CC3333 FF3333 CC3366 FF6699 FF0066
66FF00 99FF66 66CC33 669900 999966 CCCC66 FFFF66 996633 663300 996666 CC6666 FF6666 990033 CC3399 FF66CC FF0099
33FF00 66FF33 339900 66CC00 99FF33 CCCC99 FFFF99 CC9966 CC6600 CC9999 FF9999 FF3399 CC0066 990066 FF33CC FF00CC
00CC00 33CC00 336600 669933 99CC66 CCFF99 FFFFCC FFCC99 FF9933 FFCCCC FF99CC CC6699 993366 660033 CC0099 330033
33CC33 66CC66 00FF00 33FF33 66FF66 99FF99 CCFFCC   CC99CC 996699 993399 990099 663366 660066
006600 336633 009900 339933 669966 99CC99   FFCCFF FF99FF FF66FF FF33FF FF00FF CC66CC CC33CC
003300 00CC33 006633 339966 66CC99 99FFCC CCFFFF 3399FF 99CCFF CCCCFF CC99FF 9966CC 663399 330066 9900CC CC00CC
00FF33 33FF66 009933 00CC66 33FF99 99FFFF 99CCCC 0066CC 6699CC 9999FF 9999CC 9933FF 6600CC 660099 CC33FF CC00FF
00FF66 66FF99 33CC66 009966 66FFFF 66CCCC 669999 003366 336699 6666FF 6666CC 666699 330099 9933CC CC66FF 9900FF
00FF99 66FFCC 33CC99 33FFFF 33CCCC 339999 336666 006699 003399 3333FF 3333CC 333399 333366 6633CC 9966FF 6600FF
00FFCC 33FFCC 00FFFF 00CCCC 009999 006666 003333 3399CC 3366CC 0000FF 0000CC 000099 000066 000033 6633FF 3300FF
00CC99   0099CC 33CCFF 66CCFF 6699FF 3366FF 0033CC   3300CC
  00CCFF 0099FF 0066FF 0033FF  

These days most computer systems can easily display the full range of RGB colors and we don't need to stick strictly to the "web safe" colors. If however, your web site needs to target users who could be using older systems or AOL users limited to 256 colors then you should design your site with only "web safe" colors. For this course feel free to use the full RGB range of colors for your work.

Top of page

Predefined Colors

The W3C has defined a set of predefined named colors that can be used instead of hexadecimal numbers for color values in HTML code. These predefined names make the HTML code more readable. You should be aware that predefined named colors should, but are not guaranteed to render the same as the hex equivalent values. Look at the first two columns of this table in your browser. The colors should be the same in both columns. How does your browser stack up? You should also note that not all predefined colors are "web safe."

 Named  Numeric Color Name Hex RGB Decimal
    AliceBlue #F0F8FF 240,248,255
    AntiqueWhite #FAEBD7 250,235,215
    Aqua #00FFFF 0,255,255
    Aquamarine #7FFFD4 127,255,212
    Azure #F0FFFF 240,255,255
    Beige #F5F5DC 245,245,220
    Bisque #FFE4C4 255,228,196
    Black #000000 0,0,0
    BlanchedAlmond #FFEBCD 255,235,205
    Blue #0000FF 0,0,255
    BlueViolet #8A2BE2 138,43,226
    Brown #A52A2A 165,42,42
    BurlyWood #DEB887 222,184,135
    CadetBlue #5F9EA0 95,158,160
    Chartreuse #7FFF00 127,255,0
    Chocolate #D2691E 210,105,30
    Coral #FF7F50 255,127,80
    CornflowerBlue #6495ED 100,149,237
    Cornsilk #FFF8DC 255,248,220
    Crimson #DC143C 220,20,60
    Cyan #00FFFF 0,255,255
    DarkBlue #00008B 0,0,139
    DarkCyan #008B8B 0,139,139
    DarkGoldenrod #B8860B 184,134,11
    DarkGray #A9A9A9 169,169,169
    DarkGreen #006400 0,100,0
    DarkKhaki #BDB76B 189,183,107
    DarkMagenta #8B008B 139,0,139
    DarkOliveGreen #556B2F 85,107,47
    DarkOrange #FF8C00 255,140,0
    DarkOrchid #9932CC 153,50,204
    DarkRed #8B0000 139,0,0
    DarkSalmon #E9967A 233,150,122
    DarkSeaGreen #8FBC8F 143,188,143
    DarkSlateBlue #483D8B 72,61,139
    DarkSlateGray #2F4F4F 47,79,79
    DarkTurquoise #00CED1 0,206,209
    DarkViolet #9400D3 148,0,211
    DeepPink #FF1493 255,20,147
    DeepSkyBlue #00BFFF 0,191,255
    DimGray #696969 105,105,105
    DodgerBlue #1E90FF 30,144,255
    FireBrick #B22222 178,34,34
    FloralWhite #FFFAF0 255,250,240
    ForestGreen #228B22 34,139,34
    Fuchsia #FF00FF 255,0,255
    Gainsboro #DCDCDC 220,220,220
    GhostWhite #F8F8FF 248,248,255
    Gold #FFD700 255,215,0
    Goldenrod #DAA520 218,165,32
    Gray #808080 128,128,128
    Green #008000 0,128,0
    GreenYellow #ADFF2F 173,255,47
    Honeydew #F0FFF0 240,255,240
    HotPink #FF69B4 255,105,180
    IndianRed #CD5C5C 205,92,92
    Indigo #4B0082 75,0,130
    Ivory #FFFFF0 255,255,240
    Khaki #F0E68C 240,230,140
    Lavender #E6E6FA 230,230,250
    LavenderBlush #FFF0F5 255,240,245
    LawnGreen #7CFC00 124,252,0
    LemonChiffon #FFFACD 255,250,205
    LightBlue #ADD8E6 173,216,230
    LightCoral #F08080 240,128,128
    LightCyan #E0FFFF 224,255,255
    LightGoldenrodYellow #FAFAD2 250,250,210
    LightGreen #90EE90 144,238,144
    LightGrey #D3D3D3 211,211,211
    LightPink #FFB6C1 255,182,193
    LightSalmon #FFA07A 255,160,122
    LightSeaGreen #20B2AA 32,178,170
    LightSkyBlue #87CEFA 135,206,250
    LightSlateGray #778899 119,136,153
    LightSteelBlue #B0C4DE 176,196,222
    LightYellow #FFFFE0 255,255,224
    Lime #00FF00 0,255,0
    LimeGreen #32CD32 50,205,50
    Linen #FAF0E6 250,240,230
    Magenta #FF00FF 255,0,255
    Maroon #800000 128,0,0
    MediumAquamarine #66CDAA 102,205,170
    MediumBlue #0000CD 0,0,205
    MediumOrchid #BA55D3 186,85,211
    MediumPurple #9370DB 147,112,219
    MediumSeaGreen #3CB371 60,179,113
    MediumSlateBlue #7B68EE 123,104,238
    MediumSpringGreen #00FA9A 0,250,154
    MediumTurquoise #48D1CC 72,209,204
    MediumVioletRed #C71585 199,21,133
    MidnightBlue #191970 25,25,112
    MintCream #F5FFFA 245,255,250
    MistyRose #FFE4E1 255,228,225
    Moccasin #FFE4B5 255,228,181
    NavajoWhite #FFDEAD 255,222,173
    Navy #000080 0,0,128
    OldLace #FDF5E6 253,245,230
    Olive #808000 128,128,0
    OliveDrab #6B8E23 107,142,35
    Orange #FFA500 255,165,0
    OrangeRed #FF4500 255,69,0
    Orchid #DA70D6 218,112,214
    PaleGoldenrod #EEE8AA 238,232,170
    PaleGreen #98FB98 152,251,152
    PaleTurquoise #AFEEEE 175,238,238
    PaleVioletRed #DB7093 219,112,147
    PapayaWhip #FFEFD5 255,239,213
    PeachPuff #FFDAB9 255,218,185
    Peru #CD853F 205,133,63
    Pink #FFC0CB 255,192,203
    Plum #DDA0DD 221,160,221
    PowderBlue #B0E0E6 176,224,230
    Purple #800080 128,0,128
    Red #FF0000 255,0,0
    RosyBrown #BC8F8F 188,143,143
    RoyalBlue #4169E1 65,105,225
    SaddleBrown #8B4513 139,69,19
    Salmon #FA8072 250,128,114
    SandyBrown #F4A460 244,164,96
    SeaGreen #2E8B57 46,139,87
    Seashell #FFF5EE 255,245,238
    Sienna #A0522D 160,82,45
    Silver #C0C0C0 192,192,192
    SkyBlue #87CEEB 135,206,235
    SlateBlue #6A5ACD 106,90,205
    SlateGray #708090 112,128,144
    Snow #FFFAFA 255,250,250
    SpringGreen #00FF7F 0,255,127
    SteelBlue #4682B4 70,130,180
    Tan #D2B48C 210,180,140
    Teal #008080 0,128,128
    Thistle #D8BFD8 216,191,216
    Tomato #FF6347 255,99,71
    Turquoise #40E0D0 64,224,208
    Violet #EE82EE 238,130,238
    Wheat #F5DEB3 245,222,179
    White #FFFFFF 255,255,255
    WhiteSmoke #F5F5F5 245,245,245
    Yellow #FFFF00 255,255,0
    YellowGreen #9ACD32 154,205,50

Top of page

Working With Color

When designing a web site you will need to decide on a common color scheme that will be used throughout the site. There are some tools available on the web to help you in choosing a color scheme. These work by letting you pick a primary color and the tool suggesting colors that will work well with the primary color. Try Color Schemer Studio at www.colorschemer.com. This tool has both a Mac and a PC version. A free PHP color schemer is available at www.hypergurl.com/colormatch.php.

When choosing color schemes you should keep in mind that colors can have an effect on people's moods and emotions. The following table lists some common colors and their associations.

Color Association
Pink romance, love, friendship, feminine qualities, and passiveness
Light Red joy, sexuality, passion, sensitivity, and love
Red fire, blood, energy, war, danger, warning, strenght, power, passion, desire, and love
Dark Red vigor, will power, rage, anger, leadership, courage, longing, malice, and wrath
Red-Orange desire, sexual passion, pleasure, domination, aggression, and thirst for action
Orange joy, sunshine, tropics, enthusiasm, fascination, happiness, creativity, determination, attraction, success, encouragement, and stimulation
Dark Orange deceit, distrust
Gold prestige, illumination, wisdom, wealth
Light Yellow intellect, freshness, and joy
Yellow sunshine, joy, happiness, intellect, energy
Dull Yellow caution, decay, sickness, jealousy
Aquamarine emotional healing and protection
Yellow Green sickness, cowardice, discord, and jealousy
Green nature, growth, harmony, freshness, and fertility
Olive Green peace
Dark Green ambition, greed, and jealousy
Light Blue health, healing, tranquility, understanding, and softness
Blue water, sky, trust, loyalty, wisdom, confidence, intelligence, faith, truth, and heaven
Dark Blue knowledge, power, integrity, and seriousness
Light Purple romantic and nostalgic
Purple royalty, power, nobility, luxury, ambition, wealth, extravagance, wisdom, dignity, independence, creativity, mystery, and magic
Dark Purple gloom and sad feelings
Brown earth, warmth, home, chocolate, stability, masculine qualities
Black power, elegance, formality, death, evil, and mystery
White light, goodness, innocence, purity, and virginity

Top of page