Also keep in mind that the absolutes regarding uniform colors are not really absolutes but "most of the times." If they were on a tight deadline or budget, they may have thrown an actor into whatever they had available, but normally they were consistent.
Also, sometimes in the context of the story a character will change position without necessarily changing uniforms, but sometimes they do. For example, when Data was moved to first officer under Captain Jellico in "Chain of Command," he switched to the red/maroon uniform. But when he was placed in command of the Excalibur in "Redemption," he stays in gold.