This page is best viewed with Microsoft® Internet Explorer (v2.0)internet link


RGB Color Table

New in Internet Explorer 2.0 is the ability to set the background color of individual cells in a table.

I've provided some C code here that will output the HTML code to display a table that lists all possible RGB colors (in increments of 0x33), and sets the "hotlink" reference of each cell to the RGB triplet of the color it represents. This way, all you have to do is move your mouse over the color you want to know the value of, and the RGB triplet will be displayed in the status bar. Cool, huh?

void main ()
{
  unsigned int r, g, b,c=0;
  printf ("<HTML><BODY>\n");
  printf ("<H1>RGB Color Table</H1><P>\n");
  printf ("Moving your mouse over any of the colors\n");
  printf ("below will display the RGB color entry\n");
  printf ("for that color in the status bar of your\n");
  printf ("browser.<P>\n");
  printf ("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR>\n");
  for (r=0; r<=0xFF; r+=0x11) {
    for (g=0; g<=0xFF; g+=0x11) {
      for (b=0; b<=0xFF; b+=0x33) {
        printf ("<TD bgcolor=#%2.2X%2.2X%2.2X>",r,g,b);
        printf ("<A NAME=\"#%2.2X%2.2X%2.2X\" ",r,g,b);
        printf ("HREF=\"#%2.2X%2.2X%2.2X\">",r,g,b);
        printf ("&nbsp &nbsp &nbsp </A></TD>");
        c++;
        if (c>=24) {
          printf ("</TR><TR>");
          c=0;
        }
        printf ("\n");
      }
    }
  }
  printf ("</TR></TABLE>\n");
  printf ("</BODY></HTML>\n");
}
Robert B. Hess
roberth@microsoft.com
One Microsoft Way
Redmond WA, 98052-6399

© 1996 Microsoft Corporation