I always wondered why Troi didn't wear a traditional Star Fleet uniform for the first 6 seasons and why that seemed ok with Star Fleet's dress code.
She was the ship's counselor. Check out the rec deck scene in ST:TMP: crew people in all manner of uniform variations, and some in what might be civvies. Native Americans wore their feathers and beads. The Rhaandarites had hair lengths to their collars, seemingly not regulation Starfleet cuts. Spock and Ilia had collar variations.
In TNG, Worf wears a traditional Klingon sash and Ro wears her earring. That seemed okay with the dress code, too.
Obviously it was felt that crew members might unload their problems more effectively to a counselor in more casual dress. She also cares for the mental health of officers' families.