Operation Manual

52 Working with Graphics, Animation, and Multimedia
Bear in mind that not all your visitors’ computers will match your own
for speed or graphic display. Like the .GIF format, some monitors are
still limited to 256 colors. It’s generally a good idea to switch your
display to 256 colors and test the page in a browser before finally
publishing it. This will ensure you’re using colors in a way that won't
present problems when displayed on average systems. The more you
know about color palettes and image formats, the fewer display
problems are likely to creep in.
Note: If you’re quite sure all your intended visitors can display more
than 256 colors, the following section isn’t required reading. On the
other hand, the knowledge is likely to prove useful when working with
any on-screen graphics, just as knowing basic color theory serves you
in the realm of printed publications.
A major constraint imposed by 256-color systems is that not all
systems use the same 256 colors. The operating system reserves a
certain number of palette slots for “system colors,” and system palettes
differ, for example, between Windows and Macintosh computers.
Applications, including Web browsers, declare their own palettes and
use dithering to approximate colors outside that palette. This means,
for example, alternating pixels of red and blue (from within the palette)
to approximate a purple color outside the palette.
If you’re not careful, dithering can ruin your best efforts. Let’s say
you’ve created a graphic with some solid color areas, but the user’s
browser can’t display one of those colors. So the browser dithers the
color, resulting in a mottled and degraded image. If the solid color
happened to include text, the text becomes less legible.
To prevent display of this kind, Web designers often use a Web-safe
palette of 216 colors that don’t dither in Web browsers operating in
256-color environments. The safe palette is actually a 6x6x6 RGB
“color cube” using evenly-spaced red, green, and blue values from 0 to
255 along its axes. 51 happens to be the interval in the series of values
(0, 51, 102, 153, 204, 255). So, for example, the RGB definition
“0,102,51” would be a safe color, while “0,102,52” would not. To
create Web-safe colors in a paint program, define new colors using
RGB values that are either 0 or divisible by 51.