On some Starfleet vessels, certain crew members were granted permission, at the captain's discretion, to wear casual duty attire while serving on board. This diversion from the standard uniform code was typically granted to senior officers in specialized positions. (TNG: "Chain of Command, Part I" )