relationship between #xxxxxx color codes and actual pixels?
by Bennett Haselton <bennett(at)peacefire.org>
|
Date: |
Sat, 30 Jun 2001 19:33:29 -0700 |
To: |
hwg-graphics(at)hwg.org |
|
todo: View
Thread,
Original
|
|
If I create one HTML page with
<body bgcolor=#DFDFDF>
</body>
in the source, and another page with
<body bgcolor=#E0E0E0>
</body>
in the source, and view the documents side by side in two open browser
windows (either Netscape 4.75 or IE 5.5), the background colors look the
same (as they should, since the colors differ by only 1 in the red, green,
and blue component).
However, if I take a screen capture and then open the screen capture in a
graphics program such as Paint Shop Pro, then analyzing the pixels shows
that the two windows have *exactly* the same background color,
corresponding to an RGB value of #DFDFDF. Then if I create a graphic in
Paint Shop Pro and give it the solid color corresponding to RGB value
"#E0E0E0", the color is visibly different from the color of the browser
window that is opened on a document with background color #E0E0E0 specified
in the HTML.
What is the relationship between the #xxxxxx color value specified in HTML,
and the actual RGB color that will be displayed for that color in the
browser window? Do the browsers keep a list of colors in memory, smaller
than the list of 16 million possible colors that can be specified in a
#xxxxxx tag, and then "round off" each #xxxxxx-specified color to one of
the colors on the shorter list?
This is important because I might want to create an image of a circle that
will appear against a Web page of a given background color. Of course I
could create a GIF and make the background color of that image transparent,
so that the user just sees a circle surrounded by the page background
color. But what if I want the border around the circle to blur/fade from
the color of the circle to the color of the background? As far as I know,
you can't do a fade from a solid color to transparent. You would have to
do a fade from the color of the circle to the background color of the Web
page -- and, for that, you need to ensure that the color of the pixels
around the edge of your image matches the Web page background color.
-Bennett
bennett(at)peacefire.org http://www.peacefire.org
(425) 649 9024
HWG: hwg-graphics mailing list archives,
maintained by Webmasters @ IWA