New tool: the same planner is opensnes-palette plan (opensnes-palette — a project's palettes), with a settings file beside the asset; this tool stays shipped for one more version.
The SNES gives you exactly 8 background palettes and 8 sprite palettes of 16 colours each — 256 CGRAM entries, no more. Every .pal your game loads has to land in one of those slots, at a CGRAM colour index you pass to dmaCopyCGram. Pick two overlapping indices and one asset silently recolours the other; leave a slot half-used and you run out sooner than you had to. Fitting many palettes into that space is the single most-cited SNES asset headache, and nothing in the pipeline helped — until palplan.
palplan reads a manifest of your project's palettes and plans the whole CGRAM layout for you: it merges identical palettes, assigns collision-free slots, tells you when you have asked for more than the hardware has, and writes a C header so your code never hard-codes a magic index again.
In: a small text manifest listing your .pal files (the BGR555 palettes gfx4snes — images to tiles, palettes & maps writes with -p), each tagged bg or sprite.
Out:
| File | What it is | Loaded with |
|---|---|---|
| (stdout) | the allocation table + collision / near-duplicate report | — (read it) |
| .h (-o) | named CGRAM offsets: PAL_<NAME>_CGRAM, _SLOT, _COLORS | #include |
| .pal (-b) | one combined 512-byte CGRAM image | dmaCopyCGram(img, 0, 512) |
One palette per line, # comments, three whitespace columns — name, type (bg or sprite), file. Paths resolve relative to the manifest's directory:
| Flag | Meaning |
|---|---|
| -o FILE | write the C header of named CGRAM offsets |
| -b FILE | write the combined 512-byte CGRAM image (one-shot DMA) |
| -t N | near-duplicate hint threshold, in differing colours (default 2, 0 = off) |
| -q | quiet — suppress the table, keep hints and errors |
The header turns a hand-counted index into a name:
and PAL_<NAME>_SLOT is the palette bank you hand to gfx4snes -e so a tilemap's entries reference the matching slot.
The why behind the 8+8 slot budget and the BG-0–127 / sprite-128–255 convention is Planning your SNES game. Read it alongside this page.