Web Safe Colors

Web safe colors are a bit of an outdated concept since most monitors now display millions of colors. But there was a time when monitors only displayed 256 individual colors.

When 256 color monitors were the norm, there was a set of 216 colors that were deemed "web safe" in that they would display roughly the same on any computer. These colors are displayed below.

All of the web safe colors have red, green, and blue values of 0, 51, 102, 153, 204, or 144. Strange numbers, but they're all multiples of 51. If you're interested, there's more information on web safe colors on HTML Goodies. The colors are listed with their hex values below. Notices all of the values are either 00, 33, 66, 99, cc, or ff. These values are the hex values of the multiples of 51.

So, why 216 if the computers of the day could display 256 colors? Why get rid of 40?

First thought is that some operating systems reserved 16 to 20 colors for internal use. Doesn't explain 40, but it's a start.

Second thought, and the one that makes sense - to me at least, is mathematical. 216 colors allows for 6 equally spaced shades of red, green, and blue. 6 * 6 * 6 = 216.

And if you're interested, below the swatches is the PHP code used to create an array of all the hex codes for this grid.

"Really Safe" Web Colors

There is also a set of 22 colors that were considered "really safe." This is because the rest of the colors in the set of 216 didn't always display consistently. Most of the 22 really safe colors are shades of green and yellow.

PHP Code for Web Safe Colors

This is roughly the code that's used to build the array of hex codes on this page.