Using and Converting to Color-Safe Palettes
   
Home: Graphic Academy
 
Graphics Books
 
Graphics File Formats
  Animation File Formats
Bitmap File Formats
CAD File Formats
Cursor File Formats
Font File Formats
Icon File Formats
Metafile File Formats
Prepress File Formats
Vector File Formats
Video File Formats
Web File Formats
More Graphics File Formats
 
Graphics Software
  Banner Design Software
CAD Software
Diagram Drawing Software
Illustration Software
Photo Editing Software
Video Conversion Software
More Graphics Software
 
Graphics Tutorials
 
  • Adobe Dreamweaver Tutorials
  • Adobe Photoshop Tutorials
  • AutoCAD Tutorials
  • How To Draw Tutorials
    Banner Design Tutorial
    Banner Display Tutorial
    Color Combinations Tutorial
    Color-Safe Conversion Tutorial
    eBook Covers Tutorial
    Favicon Tutorial
    GIF + Photo Tutorial
    Good Web Design
    Image Slice Tutorial
    Image Tiling Tutorial
    Imagemap Tutorial
    Photography Tutorial
    Prevent Copying Tutorial
    Screenshots Tutorial
    Should I Use Flash?
    Text to Images Tutorial
    Web Image File Formats
    More Graphics Tutorials
  •  
    Graphics Glossary

         
    GraphicsAcademy.com  >  Tutorials  >  Using and Converting to Color-Safe Palettes

       

     

    Using and Converting to Color-Safe Palettes

    When you design web pages in HTML, as you probably know, you can use a tremendous range of colors (over 16 million) for fonts, tables, backgrounds and so forth using the COLOR attribute of the various HTML tags.

    One thing that many novice webmasters don't think about is whether these colors will be displayed correctly on the screens of visitors who don't have the latest whiz-bang graphics cards.

    There are still people out there who have graphics cards which are only capable of displaying 256 colors at once. In these cases, the only colors which you can be sure will be displayed correctly are those in the browser-safe color palette.

    So what happens if your web page includes a color that isn't in the color-safe palette, and a person tries to view on a 256 color screen?

    Answer: It depends on the user's web browser.
    • In some cases, the 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), the browser may attempt to simulate the your chosen color by "dithering" two or more color-safe colors together. This usually makes the colors look grainy, and very often looks absolutely terrible.

    The Solution:

    Review your HTML coding, and look at the 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 the COLOR= attributes in the HTML code, it usually looks something like this

    COLOR="#C20F8C"

    (Sometimes you may also see named colors like "RED" or "MAGENTA" which is beyond the scope of this discussion, just skip over any of those).

    The values in the quotes after the hash symbol, are actually three pairs of digits, representing the Red, Green, and Blue components of the color expressed as hexadecimal numbers in the range 00 to FF.

    So for the color given above:
    • C2 is the Red component
    • 0F is the Green component
    • 8C is the Blue component
    There is also a three-digit variant of the 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 the Red component
    • 99 for the Green component
    • CC for the Blue component

    Converting to Color-Safe Colors:

    Now we understand the theory, we're ready to convert a color to its closest color-safe equivalent.

    For each of the Red, Green and Blue components, you need to convert them separately into values, you need to convert them separately into the color-safe equivalents, and then recombine the 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
    For example:

    If we need to convert C20F8C to its closest color-safe equivalent:
    • We would convert the C2 part to CC
    • We would convert the 0F part to 00
    • We would convert the 8C part to 99
    • And thus we get CC0099 as the final color.
    Some other examples:
    • 2B2CF0 would convert to 3333FF
    • C000C0 would convert to CC00CC
    • F0A000 would convert to FF9900
    • And so on...


       
     
  •    
     
       
    Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

    Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

    Click privacy for information about our company's privacy, data collection and data retention policies, and your rights.

    Contact Us     Privacy     Terms Of Use     Advertising/Endorsements Disclosures

    Copyright © 2005-2020, Answers 2000 Limited

    In Association With Amazon.com
    Answers 2000 Limited is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.
    In Association With Amazon.co.uk
    Answers 2000 Limited is a participant in the Amazon EU Associates Programme, an affiliate advertising programme designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.co.uk.
    As an Amazon Associate, our company earns from qualifying purchases. Amazon, the Amazon logo, Endless, and the Endless logo are trademarks of Amazon.com, Inc. or its affiliates.



    CERTAIN CONTENT THAT APPEARS ON THIS SITE COMES FROM AMAZON SERVICES LLC. THIS CONTENT IS PROVIDED 'AS IS' AND IS SUBJECT TO CHANGE OR REMOVAL AT ANY TIME.
    CERTAIN CONTENT THAT APPEARS ON THIS SITE,COMES FROM AMAZON EU S.à r.l. THIS CONTENT IS PROVIDED 'AS IS' AND IS SUBJECT TO CHANGE OR REMOVAL AT ANY TIME.

    All trademarks are property of their respective owners.
    All third party content and adverts are copyright of their respective owners.

    Some graphics on our web sites are Copyright (C) 1997-2000 Hemera Technologies Inc., and used under license. All such pictures are provided for viewing purposes only and are not to be saved or downloaded. All such pictures of recognizable individuals are models and used for illustrative purposes only, and not meant to imply any association or endorsement of said individual with any product or service.