Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About Web Safe Colors

0 views
Skip to first unread message

Michael Wilcox

unread,
May 28, 2003, 8:19:07 PM5/28/03
to
If I use a non-web safe color and the page is rendered on monitor with only
the 216 safe colors available, what will happen to my color? Will it be
changed to the closest color, or is this different between different
computers?
--
Michael Wilcox
Essential Tools for the Web Developer - http://mikewilcox.t35.com
mjwilco at yahoo dot com


rf

unread,
May 28, 2003, 9:45:26 PM5/28/03
to

"Michael Wilcox" <mjwilcoCA...@yahoo.com> wrote in message
news:%lcBa.21720$Io.19...@newsread2.prod.itd.earthlink.net...

> If I use a non-web safe color and the page is rendered on monitor with
only
> the 216 safe colors available, what will happen to my color? Will it be
> changed to the closest color, or is this different between different
> computers?

Monitors, or more correctly 8 bit display cards, do not display just the 216
'safe' colours. They display 256 colours out of a palette of 16,777,216
colours. There is, literally, a palette chip on the card that translates
each of the 256 8 bit palette entries into a 24 bit RGB colour for display
on the monitor.

How does the palette get loaded? When the GUI (Windows Graphical User
Interface) is asked to display, for example, a jpeg on the display surface
it knows that there only 256 palette entries available, even though the jpeg
has many more colours than this.

The GUI will ask somebody (a codec) to decode the jpeg into a 24 bit bitmap
and then start rendering that bitmap to the display area. As each pixel is
rendered it's colour is searched for in the palette and the number of the
palette entry (8 bits) is written to the display surface. If that colour
does not exist yet then the next palette entry is used and the palette entry
is set to that colour. When the entire bitmap is rendered to the display
surface the palette is downloaded to the palette chip on the video card and
all the colours come to life.

If the palette becomes full then a search is made to find the nearest colour
that is in the palette. For a jpeg the palette will usually get full very
quickly. For a gif the palette will always be able to hold every colour as
there are only 256 individual colours allowed in a gif, even though each
colour can be one of the 16 million odd 24 bit colours.

Now, web safe colours. Lets say we are using gifs. We have quite a few of
them on the page. Each one can use only 256 colours but, between them, they
can use any number. Each one can have its own set of 256 colours. The
palette will usually be full at or shortly after the second gif.

What if every gif always used the same set of colours. Good idea, lets
allocate a series of colours and call them 'web safe' colours. If everybody
restricts themselves to these colours then everybody's gif will be
displayable without colour matching, that is changing a colour to the
nearest that is in the current palette.

There is one serious drawback to this though. Even though a gif can have 256
out of 16 million odd colours, a gif that adheres to 'web safe' colours is
restricted to those 216 colours. Using web safe colours *ensures* that the
colours in a gif are shifted and not to the nearest in the current palette
but the nearest 'web safe' colour, which may be *quite* different.

You, individually, do not have to adhere to this practice. So long as your
entire page has 256 colours or less then your page will not overflow the
palette. It does not matter what set of 256 colours you choose. You do not
have to choose 'web safe' colours. However, if you include on your page a
gif that uses colours different to the ones in your set then colour matching
may kick in.

These days I doubt if any gif you will find out there uses 'web safe'
colours. Most certainly you will not find a jpeg that does.

In any case those people who still use 8 bit colour cards are probably quite
used to colours being shifted so why worry about it? I have an old testing
computer with a 4 bit colour card. Yes, that's right, 16 colours. It is
entertaining to look at the web with this system :-) It is remarkable though
just how much detail in images is discernable. Text of course is fine.

Oh, by the way, in the development of video cards, somewhere between 8 bits
and the current 24 bit ones there were 15 or 16 bit ones. These cards do not
have a palette and can only display 32768 or 65536 colours. Of the 'web
safe' colours the only two these cards can display accurately are black and
white. All of the others are colour shifted by the hardware on the card.

Cheers
Richard.


Me

unread,
May 28, 2003, 11:51:10 PM5/28/03
to
I have also found that if your contrast, brightness, etc on your monitor are
off the colors will be different. There was a time in my learning years
that I thought my monitor and video card should be replaced b/c on every
other monitor I looked at a web page I created, the colors were fine.

I personally do not worry about the "web safe" colors all that much. RF was
right. Most people running low res. will not even notice. About the only
person that would know the difference is the person that created the image.

There are to many variants that come into play to really worry about the
minor color difference, in my opinion.

--
Custom Page Creations
www.custompagecreation.com
jenn...@custompagecreation.com
Website Creation & Maintenance
"rf" <making...@the.time> wrote in message
news:WCdBa.5199$ES.5...@news-server.bigpond.net.au...

FatBlokeO...@pinsmother-truckers.co.uk

unread,
Jun 2, 2003, 2:59:29 AM6/2/03
to
.
Thanx for the explanation, Richard; the fog is thinning a t-r-i-f-l-e.

Yooors,

Iain.

0 new messages