Skip to main content

HTML Color Codes

There are three main ways to change the colors being displayed on the screen: Hexadecimal, RGB and color names. The easiest one of these three is just using the color name.

Color Names

Using color names is by far the easiest method of adding color to your web pages. The only problem with this method is that it only supports a limited number of colors. Most "root" colors like: white, black, blue, yellow, cyan are supported. Another benefit is that most newer browsers will even render variants of the "root" colors.

An example would be:

color="black"
color="cyan"

You can even do some variants of the "root" colors.

color="lightGreen"

This only works with a finite amount of colors though. If you plan on using simple colors (i.e primary and secondary colors), you can just use this scheme.

RGB Color Values

RGB stands for Red, Green and Blue. These colors are primary colors and the syntax is setup as:

rgb(RED,GREEN,BLUE)

Each color is assigned a number from 0 to 255 with 255 using that color fully and 0 meaning no amount of that color is being used.

Some more examples:

rgb(0,0,0) = black
rgb(255,255,255) = white
rgb(255,0,0) = red
rgb(0,255,0) = green
rgb(0,0,255) = blue
rgb(255,255,0) = yellow // The red and green primary colors when mixed make yellow, a secondary color.

Hexadecimal Color Values

Using the hexidecimal color system is more complex to grasp, but is the more popular system for assigning colors to your web pages. This system of assigning colors is also better supported within web browsers (i.e Firefox, Internet Explorer). If you are concerned that your web pages will not look the same across web browsers, than using the hexadecimal method is the prefered method for adding color to your pages.

The scheme for Hexidecimal is as follows:

color="#RRGGBB"

The first two digits represent the amount of red, the next to are for green and the last two are for blue. The hardest part for most beginning web developers is that each digit can contain a number from 0 to 9 and a letter from A to F. An example for creating the color silver would be:

color="#C0C0C0" // Silver

You can find out more information at http://en.wikipedia.org/wiki/Web_colors

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <p><b><i><pre><a><img><em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><h1><h2><h3><h4><h5><h6>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

Premium Drupal Themes by Adaptivethemes