Continued from page 1
- In some cases, colors that aren't available will be converted to their nearest "color-safe" equivalent. This can lead to your web page looking different from what you intended.
- In other cases, particularly for large areas of continuous color (such as backgrounds and tables), browser may attempt to simulate your chosen color by "dithering" two or more color-safe colors together. This usually makes colors look grainy, and very often looks absolutely terrible. If you don't know what I mean by "dithering", see explanation at: http://www.graphicsacademy.com/what_dither.php
Review your HTML coding, and look at colors in each COLOR= attribute... then change them to their closest color-safe equivalents.
(You might want to make a safe copy of your web pages before doing this, in case you make an oopsy).
Understanding The COLOR Attribute In HTML Code:
If you look at COLOR= attributes in HTML code, it usually looks something like this
(Sometimes you may also see named colors like "RED" or "MAGENTA" which is beyond scope of this discussion, just skip over any of those).
The values in quotes after hash symbol, are actually three pairs of digits, representing Red, Green, and Blue components of color expressed as hexadecimal numbers in range 00 to FF.
So for color given above:
- C2 is Red component - 0F is Green component - 8C is Blue component
There is also a three-digit variant of above which you may very occasionally run across:
If you see something like: COLOR="#F9C"
Then you simply need to repeat each digit, thus F9C represents:
- FF for Red component - 99 for Green component - CC for Blue component
Converting to Color-Safe Colors:
Now we understand theory, we're ready to convert a color to its closest color-safe equivalent.
For each of Red, Green and Blue components, you need to convert them separately into values, you need to convert them separately into color-safe equivalents, and then recombine whole lot together.
The conversion step goes like this:
00 to 19 - converts to 00 1A to 4C - converts to 33 4D to 7F - converts to 66 80 to B2 - converts to 99 B3 to E5 - converts to CC E6 to FF - converts to FF
If we need to convert C20F8C to its closest color-safe equivalent:
- We would convert C2 part to CC - We would convert 0F part to 00 - We would convert 8C part to 99 - And thus we would CC0099 as final color.
Some other examples:
2B2CF0 would convert to 3333FF C000C0 would convert to CC00CC F0A000 would convert to FF9900 And so on...
About Author: This article was written by Sunil Tanna of Answers 2000. For more graphics tutorials, tricks and tips, please visit http://www.graphicsacademy.com/
This article was written by Sunil Tanna of Answers 2000. For more graphics tutorials, tricks and tips, please visit http://www.graphicsacademy.com/