Starting in OS 2.0, Pocket can load custom palette files in a new format called APGB. This is supported by cartridges and openFPGA that target GB.
.pal
files on the SD card in the folder /Assets/gb/common/palettes
.pal
The Game Boy, while it has a grayscale display, actually has three distinct palettes. Each palette is represented by 4 intensities from dark to bright. In this file format, each intensity is mapped to a 24-bit RGB color (3 bytes). Thus, each palette is 12 bytes, and with four palettes total, this is 48 bytes altogether. We will call each color 0 to 3 from darkest to brightest.
A complete palette set is structured as follows:
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
3
Finally, there is a color specified for when the LCD is turned off. Normally, this should be a very light (or white) color. This color will be seen during loading screens in many games. For example, Pokemon Pinball turns the LCD off when moving the pinball between the top and bottom sections of the playfield.
At the end of the file are 5 extra bytes - 0x81 and the ASCII characters APGB
. These must be present for the palette to be correctly recognized.
Here is a sample hex listing for a blue and orange palette:
000000 52528C 8C8CDE FFFFFF ; BG
000000 944A4A FF8484 FFFFFF ; OBJ0
000000 843100 FFAD63 FFFFFF ; OBJ1
000000 555555 AAAAAA FFFFFF ; Window
FFFFFF 81 41504742 ; LCDoff and footer