Color Detection
Another approach to dealing with the color variability issue is to detect for user capabilities using JavaScript. In 4.x generation browsers and better, the JavaScript Screen object can be used to determine the bit-depth of the user's monitor by accessing the colorDepth property. For example, this short script displays the current color depth in an alert dialog:
<script type="text/javascript">
<!--
if (window.screen)
alert(window.screen.colorDepth+"bit");
//-->
</script>
The dialog box is shown here:
In view of the color detection capability, you might consider setting screen colors based upon user screen conditions. A style sheet reference based upon the color support could be written:
<script type="text/javascript">
<!--
var bitDepth;
if (window.screen)
bitDepth = window.screen.colorDepth;
else
bitDepth = 8;
if (bitDepth > 8)
document.write('<link rel="stylesheet" href="hicolor.css" media="screen" />');
else
document.write('<link rel="stylesheet" href="locolor.css" media="screen" />');
//-->
</script>
<noscript>
<link rel="stylesheet" href="locolor.css"
media="screen" />
</noscript>
It might be a lot of work, but detection is a slight improvement over mere guesswork in achieving accurate color reproduction. Unfortunately, so far, without color reproduction profiles in Web browsers, there are many things that can derail our efforts.