HTML
  Home arrow HTML arrow Page 2 - Color Composition and HTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Color Composition and HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-03-19

    Table of Contents:
  • Color Composition and HTML
  • Possible Colors
  • Similarity in Colors
  • Making Colors Darker or Lighter

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Color Composition and HTML - Possible Colors


    (Page 2 of 4 )


    Possible Colors

    The HTML specification requires browsers to be able to recognize the following 16 names of colors: black, green, silver, lime, gray, olive, white, yellow, maroon, navy, red, blue, purple, teal, fuchsia, and aqua.

    This means that if you want the above cell to have a color of navy and a background color of fuchsia, you would type the following in the style sheet:

    td#td1 {color: navy; background-color: Fuchsia }

    Browsers can actually recognize more than these 16 names. However, if you design web pages by hand, you may not be able to remember more than these 16 colors. The next section shows you how to solve this problem.

    Composition of Color

    There are three fundamental colors. You know many colors, but each of the colors you know is made up of a combination of one or two or three of these fundamental colors. These three fundamental colors are red, green and blue.

    HTML gives you 256 intensities (levels) of each of these three fundamental colors. The intensities are identified by the numbers 0 to 255 (not 1 to 256). This means that the red color can have any number from 0 to 255 (e.g. 0, 1, 2, 200, up to 255). This is also true for the green and blue colors. With this, the navy color is written as rgb(0,0,128), where rgb stands for red, green, and blue; the first number is for red intensity, the second number stands for green intensity, and the last number is for blue intensity. The three numbers are separated by commas in the expression. The fuchsia color is written as rgb(255,0,255). So the above line of code can be written as

    td#td1 {color: rgb(0,0,128); background-color: rgb(255,0,255)}

    where navy has been replaced by rgb(0,0,128) and fuchsia has been replaced by rgb(255,0,255).

    The black color does not exist. You may be surprised to hear this, but it is true. The sensation of black is the absence of all three fundamental colors. This means that if you perceive a black color on an area of the screen, no color is actually emitted from that area of the screen. On the other hand, in HTML, white is a combination of the three fundamental colors, each at its maximum intensity. So the color black is written as rgb(0,0,0) and the color white is written as rgb(255,255,255).

    The following table gives the Red-Green-Blue combination of the 16 colors mentioned above.


    Color Name

    RGB Equivalent

    Black

    rgb(0,0,0)

    Green

    rgb(0,128,0)

    Silver

    rgb(192,192,192)

    Lime

    rgb( r0,255,0)

    Gray

    rgb(128,128,128)

    Olive

    rgb(128,128,0)

    White

    rgb(255,255,255)

    Yellow

    rgb(255,255,0)

    Maroon

    rgb(128,0,0)

    Navy

    rgb(0,0,128)

    Red

    rgb(255,0,0)

    Blue

    rgb(0,0,255)

    Purple

    rgb(128,0,128)

    Teal

    rgb(0,128,128)

    Fuchsia

    rgb(255,0,255)

    Aqua

    rgb(0,255,255)

    So instead of typing any of the above names in your CSS, you can type the equivalent RGB code. For example, instead of typing “purple,” you can type “rgb(128,0,128)”.

    More HTML Articles
    More By Chrysanthus Forcha


       · You are an HTML coder. Do you want to see a color anywhere and reproduce it. If your...
     

    HTML ARTICLES

    - Building Single Row Database Forms with HTML
    - Introduction to Database Forms with HTML
    - Another Look at Animation of Geographical Ma...
    - Animation of Geographical Map Regions
    - Changing and Moving Pictures with CSS
    - Clickable Geographical Map Regions
    - Gradient Creation with the HR Element
    - Text on HTML Images: Do it Yourself
    - Custom Buttons in HTML
    - Quick Web Page Menu
    - Maximizing and Restoring HTML Images with th...
    - Maximizing and Restoring HTML Images with th...
    - Handling Hyperlinks and Images in HTML
    - Quick Start with HTML
    - HTML Tips






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway