In TOS they also used the ship's emblem to define the divisions. The definitions pretty much carried over to TNG. Though there were the occasional slips where the emblem didn't match the shirt or the shirt and emblem didn't match the job.