Back in the days of low video memory, storing each pixel as a multi-byte color value (such as in today's "High Color" and "True Color" modes common under MS Windows) was not practical. Instead, a common method for was to create a palette of 256 different colors (usually of 3 bytes each), and then use single byte values to index into that. The ability of a video card to use such a palette was known as "VGA compatibility".
This dramatically decreased the memory requirements of a given image, though it lowered the amount of colors that could be used in any single moment.
There are a total of five "complete" palettes for UFO and three for TFTD, each for a different situation. Each is made up of the standard 256 colors stored as three byte RGB records (A value for Red, a value for Green, and a value for Blue). This makes a total of 768 bytes per palette.
Each RGB value has a maximum intensity of 63/x3F (making a total of 262,144 shades available, which seems to be standard for VGA), as opposed to 255/xFF (which would have provided 16,777,216). If you want to use the 64 intensity values in a 256 intensity world, just multiply each value by 4 and you'll achieve the correct strength (or near enough - at least, this is how the CE versions of the game deal with the issue). Each palette has a six byte 'buffer' following it. While their meanings are unknown, they are:
UFO: TFTD: Pal1: B7 13 FF 76 FE 50 Pal1: 66 83 7D F8 01 75 Pal2: A1 E8 13 0B 06 E6 Pal2: 45 F0 01 C0 01 D0 Pal3: 01 00 8B 46 FA 0B Pal3: B8 13 00 00 00 E8 Pal4: FF 76 10 FF 76 0E Pal5: C8 1E 00 00 1E B8
Five palettes of 768 bytes each, plus five buffers of 6 bytes each, makes 3,870 bytes in Palettes.Dat (or 2,322 for TFTD's three palettes).
Color 0 is not used in the game, it instead represents "transparency" (ie. Pixels which should not be drawn to the screen).
The UFOpedia uses the first, second, fourth or fifth palettes, depending on the requirements of the entry being displayed.
The second-to-final 16 colors of each palette are reserved. These are replaced in-game by the colors from the appropriate BACKPALS.DAT palette, and used to draw the backgrounds of the bordered windows; where there are no background images they are unused.
The exception to this is the Tactical palette, where the final 16 colors are replaced by a greyscale set stored in neither of the palette files (pictured right; presumably they are hard coded into the executable instead). These colors can be used by objects or terrain, etc, but are not loaded for the UFOpedia display.
Because of this there are two different sets of item images, each bearing the title "BigObs": Those used in the UFOpedia (a collection of 57 PCK files in the UFOGRAPH folder), and those used in Tactical mode (a single PCK archive in the UNITS folder).
TFTD has less palettes stored in this file then UFO and instead re-writes them as required on the fly (or uses hard coded versions from the executable).
TFTD Tactical Palettes
Like UFO, TFTD has a basic set of sprites for use in the battlescape which it shades according to the time of day. Unlike the original however TFTD has underwater missions of three different depths, as well as land missions - For each depth level a different palette is used. The tactical palettes are stored in D0...D3.LBM files.
This file contains palettes used to draw background images. These small 16 color palettes replace the second-to-final 16 entries of the primary palettes in game. They are used to display the background images of bordered windows as well as the background of the load game screens, and the terror site announcement window. They are stored using the same 3 byte RGB format as the primary palettes. This file contains eight, 16 color palettes. 128 colors in total. 384 bytes in all.