Last updated Feb 22th, 1996
Note: This document is an early release of the final specification. It is meant to specify and accompany software that is still in development. Some of the information in this documentation may be inaccurate or may not be an accurate representation of the functionality of the final specification or software. Microsoft assumes no responsibility for any damages that might occur either directly or indirectly from these inaccuracies. Microsoft may have trademarks, copyrights, patents or pending patent applications, or other intellectual property rights covering subject matter in this document. The furnishing of this document does not give you a license to these trademarks, copyrights, patents, or other intellectual property rights.
Because so many web pages use a mixture of JPEG and GIF files (often with different palettes), browsers are typically forced to fall back on a single halftone palette. Inevitably, some images, even when dithered, look awful. As embedded multimedia and OLE controls become more common, this problem will only get worse.
While it is technically possible for the browser to build an optimal palette at runtime, in practice it is an inadequate solution. Not only is the process quite slow, the results depend greatly on images and the algorithm used. The author is still at the mercy of the browser implementation.
The solution is to allow the author to specify the palette at author time. The author can fine tune the selection of images and use the many tools available for this process. At runtime, the browser simply does its best to respect the author's directive.
This document introduces an extension to the cascading style sheet syntax for controlling the palette and how images are rendered to that palette. For more information on cascading style sheets, please see the lastest draft.
This document also describes the implementation of this syntax in Microsoft Internet Explorer 3.0.
The palette property tells the browser to use the specified palette for the entire document. This property is valid only for the BODY element. The value of this property is an URL to a palette file. The palette property has two forms:
selector { palette: palette-file-url
selector { palette: color, ... }
The syntax for color in the second form is as defined in the cascading style sheet draft.
To specify the palette for an entire HTML document one would say:
BODY { palette: "http://www.site.org/some/path/file.pal" }
or
BODY { palette: #000000, #FF0000, #00FF00, #FFFF00, #0000FF, #FF00FF, #FFFFFF }
or
BODY { palette: black, red, green, yellow, blue, magenta, white }
Microsoft Internet Explorer 3.0 will initially support only one file format: the Windows .pal file.
The MIME type for this file is: x-palette/windows
Palettes are limited to 256 colors.
The dither property tells the browser how to dither an image for 8 bit display. This property is valid in the at any level in the style sheet hierarchy. Obviously the dither property has little meaning for non graphical elements. To specify the dithering for an entire document one would use:
HTML { dither: floyd-steinberg }
To control the dithering for the IMG element only:
IMG { dither: none }
The default
value is used when inheriting from another class:
HTML { dither: none } IMG.JPEG { dither: default }
Purists will note that the term dither is not entirely appropriate. However, the term has become common usage and is much clearer than map or error-diffusion.
Microsoft Internet Explorer 3.0 will recognize the following values for dither:
none | No dithering will be performed. Image pixels will be mapped to the nearest palette color. |
floyd-steinberg | The Floyd-Steinberg error-diffusion algorithm will be used. |
default | For IE 3.0 this is equivalent to floyd-steinberg. Future implementations may use a different default algorithm. |
Frames call for a slightly different behaviour. The outermost HTML document determines the palette for all inner frames. The palette property for inner frames is ignored.
Microsoft Internet Explorer 3.0 will make the palette and dither properties available to OLE controls as ambient properties. Control developers can use these properties to change how they paint. Please read Palette Behaviour for OLE Controls for more information.
The pre-release version of Microsoft Internet Explorer 3.0 distributed at the PDC ignores both the palette and dither properties. The final release will support both properties.