Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Palettes

LCD Monochrome Palettes

FF47 — BGP (Non-CGB Mode only): BG palette data

This register assigns gray shades to the color indices of the BG and Window tiles.

76543210
Color for...ID 3ID 2ID 1ID 0

Each of the two-bit values map to a color thusly:

ValueColor
0White
1Light gray
2Dark gray
3Black

In CGB Mode the color palettes are taken from CGB palette memory instead.

FF48–FF49 — OBP0, OBP1 (Non-CGB Mode only): OBJ palette 0, 1 data

These registers assigns gray shades to the color indexes of the OBJs that use the corresponding palette. They work exactly like BGP, except that the lower two bits are ignored because color index 0 is transparent for OBJs.

LCD Color Palettes (CGB only)

Colors on the Game Boy Color are stored as RGB555, meaning a single color is composed of three 5-bit components, one for each of red, green, and blue. Each 15-bit color occupies the lower part of a 16-bit word, with the 16th bit ignored by the hardware:

8-bit RGB color: #8439FF 8-bit red: $84 (132) 1 0 0 0 0 1 0 0 8-bit green: $39 (57) 0 0 1 1 1 0 0 1 8-bit blue: $FF (255) 1 1 1 1 1 1 1 1 5-bit green: 7 5-bit blue: 31 5-bit red: 17 1 1 1 1 1 0 0 High byte 1 1 1 1 0 0 0 0 Low byte = $7CF0 5-bit RGB color:

The CGB has a small amount of RAM used to store its color palettes.

Addr: 00$FF 01$7F 02$08 03$18 04$F0 05$7C 06$9F 07$4A BG0 08$FF 09$7F 0A$F0 0B$7C 0C$1F 0D$00 0E$1F 0F$42 BG1 10$FF BG2

Unlike most of the hardware interface, palette RAM (or CRAM for Color RAM) is not accessed directly, but instead through the following registers:

FF68 — BCPS/BGPI (CGB Mode only): Background color palette specification / Background palette index

This register is used to address a byte in the CGB’s background palette RAM. Since there are 8 palettes, 8 palettes × 4 colors/palette × 2 bytes/color = 64 bytes can be addressed.

First comes BGP0 color number 0, then BGP0 color number 1, BGP0 color number 2, BGP0 color number 3, BGP1 color number 0, and so on. Thus, address $03 allows accessing the second (upper) byte of BGP0 color #1 via BCPD, which contains the color’s blue and upper green bits.

76543210
BCPS / OCPSAuto-incrementAddress
  • Auto-increment: 0 = Disabled; 1 = Increment “Address” field after writing to BCPD / OCPD (even during Mode 3, despite the write itself failing), reads never cause an increment
  • Address: Specifies which byte of BG Palette Memory can be accessed through BCPD

Unlike BCPD, this register can be accessed outside VBlank and HBlank.

FF69 — BCPD/BGPD (CGB Mode only): Background color palette data / Background palette data

This register provides read/write access to the byte located at the address within the CGB’s background palette memory specified in BCPS/BGPI.

The color data format is RGB555

As each color is two bytes in size, you must read/write this register twice to access a whole color. The low byte (bits 0-7) is stored first (lower) in memory (little-endian byte order).

Much like VRAM, CGB color RAM is inaccessible when the PPU is reading from it, that is, during Mode 3

NOTE

All background colors are initialized as white by the boot ROM, however it is a good idea to initialize all colors yourself, e.g. if implementing a soft-reset mechanic.

FF6A–FF6B — OCPS/OBPI, OCPD/OBPD (CGB Mode only): OBJ color palette specification / OBJ palette index, OBJ color palette data / OBJ palette data

These registers function exactly like BCPS and BCPD respectively; the 64 bytes of OBJ palette memory are entirely separate from Background palette memory, but function the same.

Note that while 4 colors are stored per OBJ palette, color #0 is never used, as it’s always transparent. It’s thus fine to write garbage values, or even leave color #0 uninitialized.

NOTE

In CGB mode, the boot ROM leaves all object colors uninitialized (and thus somewhat random/unreliable), aside from setting the first byte of OBJ0 color #0 to $00, which is unused.

In DMG compatibility mode, the boot ROM sets the first 2 object palettes which are used by OBP0/OBP1, as explained here.

RGB Translation by CGBs

sRGB versus CGB color mixing

When developing graphics on PCs, note that the RGB values will have different appearance on CGB displays as on VGA/HDMI monitors calibrated to sRGB color. Because the GBC is not lit, the highest intensity will produce light gray rather than white. The intensities are not linear; the values $10-$1F will all appear very bright, while medium and darker colors are ranged at $00-0F.

The CGB display’s pigments aren’t perfectly saturated. This means the colors mix quite oddly: increasing the intensity of only one R/G/B color will also influence the other two R/G/B colors. For example, a color setting of $03EF (Blue=$00, Green=$1F, Red=$0F) will appear as Neon Green on VGA displays, but on the CGB it’ll produce a decently washed out Yellow. See the image above.

RGB Translation by GBAs

Even though GBA is described to be compatible to CGB games, most CGB games are completely unplayable on older GBAs because most colors are invisible (black). Of course, colors such like Black and White will appear the same on both CGB and GBA, but medium intensities are arranged completely different. Intensities in range $00–07 are invisible/black (unless eventually under best sunlight circumstances, and when gazing at the screen under obscure viewing angles), unfortunately, these intensities are regularly used by most existing CGB games for medium and darker colors.

WORKAROUND

Newer CGB games may avoid this effect by changing palette data when detecting GBA hardware (see how). Based on measurements of GBC and GBA palettes using the 144p Test Suite, a fairly close approximation is GBA = GBC × 3/4 + $08 for each R/G/B component. The result isn’t quite perfect, and it may turn out that the color mixing is different also; anyways, it’d be still ways better than no conversion.

This problem with low brightness levels does not affect later GBA SP units and Game Boy Player. Thus ideally, the player should have control of this brightness correction.