--- ---

    var
      PPal: PLogPalette;
      i: byte;
    begin
      GetMem (PPal, SizeOf(TLogPalette) + 255 * SizeOf(TPaletteEntry));
      with PPal^ do
      begin
        PalVersion := $300;
        PalNumEntries := 256;
        {$R-}
        for i := 0 to 255 do
        begin
          PalPalEntry[i].peRed := i;
          PalPalEntry[i].peGreen := i;
          PalPalEntry[i].peBlue  := i;
          PalPalEntry[i].peFlags := 0;
        end;
      end;
      Result:= CreatePalette(PPal^);
      FreeMem (PPal, SizeOf(TLogPalette) + 255 * SizeOf(TPaletteEntry));
    end;