Gene Roddenberry may have dreamed of a perfect future when he originally created Star Trek, but parts of his vision were firmly rooted in the real world, specifically in the physical makeup of the crew of the Enterprise itself.
Roddenberry, along with the show's producers, decided to take numerous cues from the United States Navy when creating the official ranks on the show, including a captain overseeing a crew made up of a commander, a handful of lieutenant commanders, lieutenants, and numerous subordinate roles. But it's the different colors of the Starfleet uniforms that really tell the story of how the Enterprise operates.
Fans know the basics: an array of blue, red, and gold shirts line the bridge of the ship every episode. Those colors weren't just randomly picked for the sake of diversity, though. They actually correspond to the ship's various service roles. The gold shirts are worn by the command division, which includes Captain Kirk, Lieutenant Sulu, and Pavel Chekov. Red uniforms belong to the engineering/communications division, including chief engineer Scotty and communications officer Uhura. The blue shirts are worn by the science/medical staff, including McCoy and Spock.
As with everything in Star Trek, though, it's a lot more complicated than all of that. In addition to the red shirts belonging to engineers and communications personnel, they are also assigned to the security division. What's the purpose of the security division on the Enterprise? Well, they're usually the mindless supporting characters who are immediately killed whenever the crew is confronted by a new enemy. This is something of a running gag for Trek fans, as whenever one of the "Red Shirts" is seen on screen, you know they're not long for this world.
Also, those gold shirts worn by Kirk and crew? Well they might not have been so gold after all. According to an interview with Star Trek's costume designer, William Theiss, the idea was for the show's uniforms to be red, blue, and green. In fact, on the set, Kirk's outfit certainly looked to be an avocado (or lime) green, but the end result was a little different when the studio lights finally hit the uniform.
"It was one of those film stock things," Theiss said, "it photographed one way—burnt orange or a gold. But in reality was another; the command shirts were definitely green."
This might come as a surprise to Trek fans until you remember that Kirk actually did wear green on a few occasions, including the times he was in formal dress and his seldom seen alternate green get-up.
These alternate uniforms were all the exact shade of green Theiss describes, but they were made from a different material than the standard Enterprise shirts and apparently had no issue retaining their natural color scheme when lit on set. The gold shade may have been a production mishap, but the color has since entered the Trek canon as the official hue of Kirk and his command staff. So, in the Star Trek universe Kirk wears gold; in the real world, though, the bridge of the Enterprise was designed with a completely different color palette in mind.
It gets more confusing when you look at the later Trek series, like The Next Generation, which had the command staff in red and operations in yellow—basically the reverse of the original series. Then, of course, the movies switched costumes and colors with nearly every entry, including the infamous powder blue monstrosities worn in Star Trek: The Motion Picture.
Roddenberry's eye for detail was unique for sci-fi TV at the time, and everything on the Enterprise had a specific purpose. So despite some production fumbles, ill-fated redesigns, and inconsistencies later on, the colors that make up Starfleet's uniforms tell a story that many viewers probably never even noticed.