Look at NewPalette for details.
function ImNewPalette(Entries: LongInt; var Pal: PPalette32): Boolean; cdecl;
ImagingExport (at line 163)