216 or 212 or 22 or 8 BROWSERSAFE COLOURS?

Go to: Henry Bottomley's home page, other JavaScript examples

This pages shows the so-called 216 browsersafe colour palette and their codes. The others are said to be unsafe because they produce dithering in 8 bit mode. The colours are the backgounds in the tables below, each with its own hex code (in a suitably clashing colour). The Javascript is designed to save typing (see the source code below). If you prefer colour names to numbers, try C J Reid's colour names for HTML. In fact, four of the colours are certainly not safe: #0033FF, #3300FF, #33FF00, #00FF33 come out too dark in IE 8bit displays. There is also some evidence to suggest that of the other colours, perhaps only 8 are safe in 15/16 bit mode: #000000, #0000FF, #00FF00, #00FFFF, #FF0000, #FF00FF, #FFFF00, and #FFFFFF; the others may produce inconsistent solid colours for GIFs and backgrounds for some browsers and hardware. See Slashdot and Webmonkey.

This is the JavaScript which produces the colours and the codes:

var hex3char="0369CF";
for (i=0; i<6; i++)
   {var backcol1="#"+hex3char.charAt(i)+hex3char.charAt(i);
    var forecol1="#"+hex3char.charAt((i+4)%6)+hex3char.charAt((i+4)%6);
    document.write("<table width='99%'>");
    for (j=0; j<6; j++)
       {var backcol2=backcol1+hex3char.charAt(j)+hex3char.charAt(j);
        var forecol2=forecol1+hex3char.charAt((j+4)%6)+hex3char.charAt((j+4)%6);
        document.write("<tr>");
        for (k=0; k<6; k++)
           {var backcol3=backcol2+hex3char.charAt(k)+hex3char.charAt(k);
            var forecol3=forecol2+hex3char.charAt((k+4)%6)+hex3char.charAt((k+4)%6);
            document.write("<td width='16%' bgcolor='",backcol3,"'><p align='center'>
                                         <font color='",forecol3,"'>",backcol3,"</font></p></td>");
           }
        document.write("</tr>");
       }
    document.write("</table>");
   }

Why does British English say colour and colours, while American English says color and colors? Something to do with the influence of French and Spanish? Probably only in part. Why these stupid questions? Is it an attempt to persuade search engines to index both spellings? Perhaps.

Go to: Henry Bottomley's home page, An optical illusion, JavaScript examples, Top