I tried to program my own colour reduction system to automate the generation of CivIII palette.
It was a bit more complex than the percentage.
Basically, you count how pixels are of each colour, and then you keep the most use colour. But the next colour is not necessary the next mose use : it is weighted by the closeness of the colour.
To make a very exagerated idea. If you have a 10x10 pixel, so 100 pixes, one is green (0,255,0), 90 are red (255,0,0), and 9 are red (240,10,0), and you want to reduce to two colours, should you keep both reds and get rid of the green, or consider the red are very close, and it's more important to keep the green?
If you have a picture or a large grass field, full of grass, and one little white rabbit in the middle, you can have many green pixels, and if you just count the number of pixels, the rabit can "disappear". If you weight the number of pixel with the difference "distance" between colours, you could keep your rabbit and the grass, except the grass will have less different hues of green.
However, my program did not work very well, because I could find a really nice way to compute the distance between two colours. It kept colours that were quite distance for the program, but to a human eye (at least mine), they were almost identical.