HTML provides you with control over the colors of items on
your pages. There are two ways to specify a color. The easiest is to simply use
the color name. You can select from the following 16 keywords:
Aqua, black, blue, gray,
green, lime, maroon, navy, olive, purple, red, silver, teal, white and yellow.
The second way, which allows specifying any color you want,
is using hex codes. This is the preferred way to specify colors because it is
universally understood and you will never get stuck trying to find the name for
that certain shade of green. To use this technique, you need to understand how
colors on a computer screen are created. Any color is a combination of the
three primary colors red, green and blue. This is why you will sometimes see
computer colors referred to as
RGB (Red Green Blue) colors. In any given color,
each of the three primary colors has a value ranging from 0 (none) to 255
(maximum), so any color can be represented by its RGB value of three numbers.
There are three formats for doing this:
Use the
RGB (r, g, b) function, where r, g and b are numbers
in the range from 0 to 25 that specify the level of red, green and blue,
respectively.
Use a hexadecimal (base 16) numbers in the form
#RRGGBB,
where RR, GG and BB are each a hexadecimal number in the range 00-FF (0-255 in
decimal notation).
Use the
rgb (r%, g%, b%) function, where r, g and b are
numbers in the range 0 to 100 that specify the level of red, blue and green as
a percentage of the maximum.
Table below some examples of colors using the
rgb() function
and hexadecimal notation. You can experiment with colors using your HTML editor
and browser to see what different values look like| Color Name | Color Code | Color Name | Color Code |
|---|---|---|---|
| Red | #FF0000 | White | #FFFFFF |
| Cyan | #00FFFF | Silver | #C0C0C0 |
| Blue | #0000FF | Gray or Grey | #808080 |
| DarkBlue | #0000A0 | Black | #000000 |
| LightBlue | #ADD8E6 | Orange | #FFA500 |
| Purple | #800080 | Brown | #A52A2A |
| Yellow | #FFFF00 | Maroon | #800000 |
| Lime | #00FF00 | Green | #008000 |
| Magenta | #FF00FF | Olive | #808000 |
A full list of HTML color codes can be found at http://www.computerhope.com/htmcolor.htm
0 comments:
Post a Comment