Look at FillCustomPalette for details.
function ImFillCustomPalette(Pal: PPalette32; Entries: LongInt; RBits: Byte; GBits: Byte; BBits: Byte; Alpha: Byte): Boolean; cdecl;
ImagingExport (at line 173)