Octree palette maker is not putting colors in order

just a thoguht here i dont even know if its possible but, would it be possible to make the octree pick the correct colors, and them pass the rbg 5 bits + alpha method to correct in the correct order using a index method in an internal image?

if its plausible ill try to do a script.