Palette File Format (PAL)

The Palette File Format (PAL) represents a logical palette, which is a collection of colors represented as RGB values. The PAL format is defined as follows:

RIFF ( 'PAL' data(<palette:LOGPALETTE>) )

LOGPALETTE is the Windows 3.0 logical palette structure, defined as follows:

typedef struct tagLOGPALETTE {
    WORD        palVersion;
    WORD        palNumEntries;
    PALETTEENTRY        palPalEntry[];
} LOGPALETTE;

Fields for the LOGPALETTE structure are described in the following table:

Field Description

palVersion Specifies the Windows version number for the structure.
palNumEntries Specifies the number of palette color entries.
palPalEntry[] Specifies an array of PALETTEENTRY data structures that define the color and usage of each entry in the logical palette.

The colors in the palette entry table should appear in order of importance. This is because entries earlier in the logical palette are most likely to be placed in the system palette.

PALETTEENTRY Structure

The PALETTEENTRY data structure specifies the color and usage of an entry in a logical color palette. The structure is defined as follows:

typedef struct tagPALETTEENTRY {
    BYTE        peRed;
    BYTE        peGreen;
    BYTE        peBlue;
    BYTE        peFlags;
} PALETTEENTRY;

Fields for the PALETTEENTRY structure are defined in the following table:

Field Description

peRed Specifies the intensity of red for the palette entry color.
peGreen Specifies the intensity of green for the palette entry color.
peBlue Specifies the intensity of blue for the palette entry color.
peFlags Specifies how the palette entry is to be used.