I've ordered the colors in the imperial color list some time ago so that the most distinctive colors were at the top of the list, and the in-between shades were at the end. Currently the AI just pick randomly.
The idea was that after the humans pick their colors, the AIs can get theirs, starting from the top of the list going down, skipping any already taken. This would generally prevent situations were AIs mostly (or all) randomly choose similar colors. For instance in a recent game i got 3 out of 4 empires with blue to blue-green colors. Especially since the detection zones can overlap and blend, the more the empire colors contrast with each other, the better.