Expand description
Palettes: what the two bits of a pixel turn into.
A tile pixel is two bits, so it names a colour index rather than a colour. The palette turns that index into a colour, which is why you can draw the same tile light in one place and dark in another.
On the original Game Boy the four shades are fixed in hardware and a palette only chooses which index gets which of them. On the Game Boy Color a palette holds four real colours. See https://gbdev.io/pandocs/Palettes.html.
Index 0 is transparent for objects, which leaves the lowest two bits of an object palette unused.
An original Game Boy ignores the colour registers and keeps drawing with the shades
set_background chose, so a cartridge that runs on both machines can set
colours without asking which it is on.
Structs§
- Color
cgb - One colour, five bits per channel.
Enums§
- ObjSlot
- Which of the two object palettes, as
OamAttr::dmg_palettepicks between.
Constants§
- COLORS
cgb - Colours in one palette.
- PALETTES
cgb - Palettes of each kind: this many for the background, and as many again for objects.
Functions§
- background
- The palette the background and window are drawn with.
- object
- One of the two object palettes.
- set_
background - Set the palette the background and window are drawn with.
- set_
background_ colors cgb - Set one background palette.
- set_
object - Set one of the two object palettes.
- set_
object_ colors cgb - Set one object palette.