I'm not sure how relevant colour quantization is now for today's display devices, but this would be great for completeness sake.
There are some well known and performant algorithms to quantize colours to 256. Relatively easy to implement too:
Octrees
Median Cut