Tool or script to reorder colors in palette

Tool or script to reorder colors in palette

Hi. I often come at the case when I need to do this. When I have a sprite with a background let's say this sprite, where the wood is the item and the magenta is the BG color. As can be seen on the palette the magenta is 13th color on the top.

For some game engines I need this color to be first.(in some game engines and tools it may also appear as last color e.g bottom right corner).

With a bit of help I created a python script to batch process many images. So I can make the first color (now orange) go to index 13 and Magenta go to first.

In a tool where I use it one by one it may seem I change order because as in the image if I just swap colors, the background becomes too close color to the rest. It can be black or the wood colors in this case.

So it is not color swap that I need? Is there an reorder way>?

it can be a script or a tool, looking for anything, Irfan view just cant do that.

Attachments: 
Preview
0palswaps.jpg 0palswaps.jpg 284.4 Kb [1 download(s)]