Palette (computing)

Palette (computing)
Color depth

1-bit monochrome
8-bit grayscale
8-bit color
15/16-bit color (High color)
24-bit color (True color)
30/36/48-bit color (Deep color)


Indexed color
RGB color model
Web-safe color

This box: view · talk · edit

In computer graphics, a palette is either a given, finite set of colors for the management of digital images (that is, a color palette), or a small on-screen graphical element for choosing from a limited set of choices, not necessarily colors (such as a tools palette).

Depending on the context (an engineer's technical specification, an advertisement, a programmers' guide, an image file specification, a user's manual, etc.) the term palette and related terms such as Web palette and RGB palette, for example, can have somewhat different meanings.


Color palettes

The following are some of the widely used meanings for color palette in computing:

  • The total number of colors that a given system is able to generate or manage (though, due to video memory limitations, it may not be able to display them all simultaneously):
  • The limited selection of colors that can be displayed simultaneously:
    • On the whole screen:
      • fixed palette selection: A given display adapter can offer a fixed color selection when its hardware registers are appropriately set. For example, the Color Graphics Adapter (CGA), in one of the standard graphics modes, can be set to show the so-called palette #1 or the palette #2: two combinations of 3 fixed colors and one user-defined background color each.
      • selected colors or picked colors: In this case, the color selection, generally from a wider explicitly available full palette, is always chosen by software, both by the user or by a program. For example, the standard VGA display adapter is said to provide a palette of 256 simultaneous colors from a total of 262,144 different colors.
      • default palette or system palette: The given selected colors have been officially standardized by some body or corporation. For example, the well known Web-safe colors for use with Internet browsers, or the Microsoft Windows default palette.
    • On an individual image:
      • color map or color table: The limited color selection is stored inside the given indexed color image file. For example, GIF.
      • image palette or image colors: The limited color selection is assumed to be the full list of the colors the given digital image has, even when the image file does not employ indexed color pixel encoding.[citation needed]
  • The underlying hardware that may be used to hold those simultaneous colors:
    • hardware palette or Color Look-Up Table (CLUT): In order to show them, the selected colors' values must be loaded in the color hardware registers of the display subsystem. For example, the hardware registers of the Commodore Amiga are known both as their color palette and their CLUT, depending on sources.

GUI palettes

An example of an on-screen color palette, as provided with the Apple GS/OS.

Graphical user interface (GUI) systems use on-screen palettes, including:

  • An arrangement of a limited set of user or system colors that can be chosen. In such cases, the expression color palette or user color palette are common equivalents. This usage resembles a true artist's palette.
  • A tool palette, a rectangular area, called a palette window, of the application screen with buttons, icons or another GUI controls available for quick command or symbol access; if the user is able to place it anywhere by moving it through a mouse or similar pointing device, it is known as a floating palette. A palette for choosing colors can be also a floating palette.

Related terms and technologies

See also Indexed color

The terms color palette, indexed color, and related terms have been used with various differences in meaning, as discussed below.

The RGB color model is today the most usual method to produce and encode colors; but colors in palettes may or may not be reproduced through red-green-blue primaries, depending on a given display hardware. To express that a given palette usage is based in the RGB color model, the term RGB palette is commonly employed, within many of the contexts in which the term palette can be used (see the previous section). The RGB color model is usually assumed by default for palettes, if not otherwise noted.

Indexed color is a technique to manage image colors in a limited fashion, in order to save RAM and video memory buffer space, file storage space, telecom bandwidth, and to speed up display refresh and telecom transfers. Instead of storing and managing every primary color component of every pixel, the most representative colors, or the fixed hardware colors, are grouped into a limited size palette: an array of color elements, in which each element (a color) is indexed by its position. This way, the pixels contain not the full color components but merely their index into the palette; this is sometimes referred as pseudocolor.

This technique saves a lot of memory/storage space and/or transmission time: if the full RGB color palette is truecolor, there are 16,777,216 different possible colors, and each pixel needs 24 bits, or 3 bytes. A typical 640×480 VGA resolution, truecolor uncompressed image needs 640×480×3 = 921,600 bytes (900 KiB). Limiting the image colors to 256, every pixel needs only 8 bits, 1 byte, so the example image now needs only 640×480×1 = 307,200 bytes (300 KiB), plus 256×3 = 768 additional bytes to store the palette map (assuming 24-bit RGB), approximately one third of the original size. Smaller palettes (4-bit 16 colors, 2-bit 4 colors) can pack the pixels even more (to 1/6 or 1/12), obviously at cost of color accuracy. While it is acceptable for little images (icons) or very simple graphics, to reproduce real-life images this loss of color availability becomes more of a problem. Some clever tricks, as color quantization, anti-aliasing, and dithering combined together can approximate indexed 256-color images to the original one.

A palette entry is one of the color items in a color palette (in hardware or in a file).

Indexed color has been widely used in early personal computers and display adapters' hardware to reduce costs. Notable computer graphics systems extensively (or even exclusively) using pseudocolor palettes include EGA and VGA (for the IBM PC compatibles), the Atari ST and Amiga's OCS and AGA.

The same way, image file formats used to encapsulate this kind of images, as PCX and GIF, which along with a header and the raw image data store the palette color maps as well, arose in the same period (circa the 1980s). Some of the more modern image file formats as BMP, TIFF and PNG also allow indexed color modes, generally up to 16 or 256 (four or eight bits per pixel). All these file formats commonly supports some compression scheme, enhancing their ability to store the indexed color images at smaller file sizes.

A Color Look-up Table (CLUT) is a hardware resource of the display subsystem, which can be used for different purposes. One is to contain the color values for a given palette in some indexed color graphic mode (lets say, 320×200 with 256 colors, often used for computer videogames). Today, CLUTs are used mainly to perform gamma and color temperature calibrations by hardware. Although the term color look-up table was coined in display hardware design field (as the machines always come first), it has been ported to the software jargon as a near synonym of palette too; but in these cases, it can mean not only the color map of an indexed color image but also any intermediary look-up table which maps one colors into another, regardless of indexed or truecolor is used.[1] In order to avoid confusion, the term CLUT is preferred for the color hardware registers and palette for the software color maps when both are employed in the same paper.[2]

Grayscale images usually do not need palettes. The pixel values can be directly the gray level in a given range (0 to 15, 0 to 255), so image files that deal with grayscale images usually do not store a palette color map for this purpose. But when displayed with color devices, generally it is necessary to synthesize a grayscale color map to manage the image properly (either by loading the color hardware registers/CLUT, or by converting the image to RGB in an RGB video memory). Some image file formats, such as BMP file format implement grayscale by storing a grayscale palette made with full RGB values.

Color depth denotes how many bits are employed to store color information in the image pixels: the more the colors managed, the more the bits employed. The pixel's bit patterns can be interpreted as whole integer numbers (which is the case for indexed color images' indices) or by assigning some bits for color related management, as relative intensities for every primary red-green-blue in RGB truecolor images. Indexed color palette sizes often have up to 2 raised to some power entries, which easily match pixel's depth bit patterns: 22 = 4, 24 = 16 or 28 = 256 are the most common choices. Highcolor uses RGB full palettes either 15-bits and 16-bits depth, while truecolor uses RGB full palettes of 24-bits depth or greater.

Adaptive versus master palettes

When using indexed color techniques, real life images are represented with better fidelity to the truecolor original one by using adaptive palettes (sometimes spelled adaptative palettes), in which the colors are selected or quantized through some algorithm directly from the original image (by picking the most frequent colors). This way, and with further dithering, the indexed color image can nearly match the original.

But this creates a heavy dependence between the image pixels and its adaptive palette. Assuming a limited 8-bit depth graphic display, it is necessary to load a given image's adaptive palette into the color hardware registers previously to the load of the image surface in itself into the video frame buffer. So to see on the screen different images with different adaptive palettes, they must to be loaded one by one, as in a slideshow. This way, all works fine. Here are samples of four different indexed color images with color patches to show their respective (and largely incompatible) adaptive palettes:

IndexedColorSample (Strawberries picked).png IndexedColorSample (Caerulea3 crop).png
IndexedColorSample (Lapis.elephant.800pix.060203).png IndexedColorSample (Lemon).png

An application can, in turn, show many different image thumbnails in a mosaic on screen. It is obvious that the program cannot load all the adaptive palettes of every displayed image thumbnail at the same time in the hardware color registers. A solution is to use a unique, common master palette or universal palette, which can be used to display with reasonable accuracy any kind of image.

This is done by selecting colors in such way that the master palette comprises a full RGB color space "in miniature", limiting the possible levels that the red, green and blue components may have. This kind of arrangement is sometimes referred as a uniform palette.[3] The normal human eye has sensibility to the three primary colors in different degrees: the more to the green, the less to the blue. So RGB arrangements can take advantage of this by assigning more levels for the green component and less to the blue.

A master palette built this way can be filled with up to 8R×8G×4B = 256 colors, but this does not leave space in the palette for reserved colors, color indices that the program could use for special purposes. It is more general to use only 6R×6G×6B = 216 (as in the Web colors case), 6R×8G×5B = 240 or 6R×7G×6B = 252, which leave room for some reserved colors.

Then, when loading the mosaic of image thumbnails (or other heterogeneous images), the program simply maps every original indexed color pixel to its most approximated in the master palette (after dumping this into the hardware color registers), and writes the result in the video buffer. Here is a sample of a simple mosaic of the four image thumbnails using a master palette of 240 RGB arranged colors plus 16 additional intermediate shades of gray; all images are put together without a significant loss of color accuracy:

IndexedColorSample (Mosaic).png

Transparent color in palettes

See also Transparency (graphic)

A single palette entry in an indexed color image can be designated as a transparent color, in order to perform a simple video overlay: superimposing a given image over a background in such way that some part of the overlapped image obscures the background and the remaining not. Superimposing film/TV titles and credits is a typical application of video overlay.

In the image to be superimposed (indexed color is assumed), a given palette entry plays the role of the transparent color. Usually the index number 0, but other may be chosen if the overlay is performed by software. At design time, the transparent color palette entry is assigned to an arbitrary (usually distinctive) color. In the example below, a typical arrow cursor for a pointing device is designed over an orange background, so here the orange areas denoted the transparent areas (left). At run time, the overlapped image is placed anywhere over the background image, and it is blended in such way that if the pixel color index is the transparent color, the background pixel is kept, otherwise it is replaced. The result is an image with irregular shapes perfectly placed over the background (right).

Transparent Color Overlay.png NOTE: this is merely an example. No actual use in a given operating system must be inferred.

This technique is used for pointing devices' cursors, in typical 2-D videogames for characters, bullets and so on (the sprites), video titling and other image mixing applications.

Some early computers, as Commodore 64, MSX and Amiga supports sprites and/or full screen video overlay by hardware. In these cases, the transparent palette entry number is defined by the hardware, and it used to be the number 0.

Some indexed color image file formats as GIF and PNG natively supports the designation of a given palette entry as transparent, freely selectable among any of the palette entries used for a given image.
The BMP file format reserves space for Alpha channel values in its Color Table[4], however currently this space is not being used to hold any translucency data and is set to zero.

When dealing with truecolor images, some video mixing equipment can employ the RGB triplet (0,0,0) (no red, no green, no blue: the darkest shade of black, sometimes referred as superblack in this context) as the transparent color. At design time, it is replaced by the so-called magic pink. The same way, typical desktop publishing software can assume pure white, RGB triplet (255,255,255) from photos and illustrations to be excluded in order to let the text paragraphs to invade the image's bounding box for irregular text arrangement around the image's subjects.

2-D painting programs, like Microsoft Paint and Deluxe Paint, can employ the user designated background color as the transparent color when performing cut, copy, and paste operations.

Although related (due to they are used for the same purposes), image bit masks and alpha channels are techniques which not involve the use of palettes nor transparent color at all, but off-image added extra binary data layers.

System and logical palettes under Microsoft Windows

Microsoft Windows applications manage the palette of 4-bit or 8-bit indexed color display devices through specialized functions of the Win32 API (for Highcolor and Truecolor display modes, such functions lacks any interesting functionality). These APIs deals with the so-called system palette and with many logical palettes.

The system palette is a copy in RAM of the color display's hardware registers, primarily a physical palette, and it is a unique, shared common resource of the system. At boot, it is loaded with the default system palette (mainly a master palette which works well enough with most programs).

When a given application intends to output colorized graphics and/or images, it can set their own logical palette, that is, its own private selection of colors (up to 256). It is supposed that every graphic element that the application tries to show on screen employs the colors of its logical palette. Every program can manage freely one or more logical palettes without further expected interference (in advance).

Before the output is effectively made, the program must to realize its logical palette: the system tries to match then the logical colors with physical ones. If an intended color is already present into the system palette, the system internally maps both the logical and the system palette indexes (due to they rarely coincide). If the intended color is not present yet, the system applies an internal algorithm to discard the least used color in the system palette (generally, some used by another window in the background) and substitutes it with the new color. Due to there are limited room for colors in the system palette, the algorithm tries also to remap similar colors together, and always by avoiding redundant colors.

The final result depends on how many applications are working with on screen colors. The foreground window is always favoured, so windows at background may behave in different ways: from become corrupted to quickly redraw themselves. When the system palette changes, the system triggers a specific event to inform every application. When received, a window can quickly redraw itself using a single Win32 API function. But this must be doing explicitly in the program code; hence the fact that many programs lack in manage this event, and their windows become corrupt in this situation.

An application can force the system palette to be loaded with specific colors and even in a specific order, tricking the system by telling they are color entries intended for animation (quick color changes of the colors in the physical palette at specific entries). The system cannot assume then that every hardware palette entry is free for their palette color managements, and those entries are excluded from its algorithm. The final result depend on the skills of the color forcing program and the behaviour of the other programs (the lasts exactly as in the regular case), and that of the operating system in itself.


  1. ^ The TIFF file format specification, revision 5.0 (compare "ColorMap " and "Color Response Curves" sections)
  2. ^ Computer Graphics, Prof. R. Eckert, Lect. #5, February 2001, Binghamton U., N.Y.
  3. ^ Handmade Software's Image Alchemy User's Manual.
  4. ^ MSDN. "RGBQUAD Color Table Entry" [1]


See also

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Palette — A palette (IPAEng|ˈpælɨt) is: a surface on which a painter mixes colour pigments. A palette may be made of wood, glass, plastic, ceramic tile or other inert material and can vary greatly in size and shape. The most commonly known type of painter… …   Wikipedia

  • Palette window — A palette window, also known as utility window or floating palette, is a type of computing window which floats on top of all regular windows and offers tools or information for the current application.In Mac OS X, palette windows are only visible …   Wikipedia

  • Window (computing) — This article is about the graphical display of the functions of a computer. For the operating system, see Microsoft Windows. For other uses, see Window (disambiguation). An example of some windows in a graphical user interface GNOME. Two… …   Wikipedia

  • Menu (computing) — A generic application menu In computing and telecommunications, a menu is a list of commands presented to an operator by a computer or communications system. A menu is used in contrast to a command line interface, where instructions to the… …   Wikipedia

  • Button (computing) — For the buttons used to identify a program used to build a web site, see Web button. For keyboard buttons, see Keyboard (computing). Different types of buttons in GTK+. In computing, a button (sometimes known as a command button or push button)… …   Wikipedia

  • Indexed color — A 2 bit indexed color image. The color of each pixel is represented by a number; each number (the index) corresponds to a color in the color table (the palette). In computing, indexed color is a technique to manage digital images colors in a… …   Wikipedia

  • Color quantization — An example image in 24 bit RGB color The same image reduced to a palette of 16 colors specifically chosen to best represent the image; the selected palette is shown by the squares above In …   Wikipedia

  • Colour look-up table — A colour look up table (CLUT) is a mechanism used to transform a range of input colours into another range of colours. It can be a hardware device built into an imaging system or a software function built into an image processing application. The …   Wikipedia

  • List of 16-bit computer hardware palettes — This is a list of color palettes of some of the most popular 16 bit personal computers, roughly those manufactured from 1985 to 1995. All of them are based on RGB palettes; although some output in composite video, the internal logic to produce… …   Wikipedia

  • List of monochrome and RGB palettes — For a full listing of computer s color palettes, see List of palettes This list of monochrome and RGB palettes includes generic repertoires of colors (color palettes) to produce black and white and RGB color pictures by a computer s display… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”