AFAIK the two parties became associated with their specific colors in the 2000 election when one of the major news outlets was doing live coverage of the election. They had a graphic of the country with each state marked red/blue depending on which party had won that state, and were referring to them as red or blue states. Apparently before that point, the parties didnt have specific colors associated, and in fact red was still heavily associated with communism.
AskHistorians
Wow, I had no idea that it might be that recent! It's one of those things I never thought much of.
Because an outdated first-past-the-post system automatically leads to a two-party system.
Could you clarify your question? Are you asking why in political coverage one party is represented by the color red and the other by blue? Or were you intending to ask a different question?
It's a result of our voting system, first past the post takes all. The party with 51% of the vote gets the seat (all of the representation), parties with 49% of the vote or less get nothing at all. This is a "winner take all" system. When you get nothing when you lose, being on the side of the winning candidate is really important, so people don't care to align themselves with anyone other than the top 2 candidates. This mostly comes up when a candidate tries to "split the vote". A candidate splits the vote when they are popular within their party but didn't win the primary, so they try to contest their party's candidate by running in a third party. Splitting the vote is considered extremely poor strategy, because what happens is you get a 50/25/25 split. As in, almost nobody in the other party will vote for you, so you are competing with the other candidate for 50% or less of the voting population. It's a losing proposition by default.
Edit: oh if you mean the literal colors, yeah those are our flag colors. politicians wear them to indicate patriotism.
As far as the two party system it came up rather quickly. Sorta as groups around particular personalities that kinda solidified into parties. The way I understood it the founding fathers had actually though each state would be putting forth favorite sons for president and they thought every election would be a battle royale. They though representatives in congress would be more about state they are from than a party. I can say even in my lifetime congressmen have become less and less about state and more and more about party. Also senators, representatives, judges, and presidents use to view each other as rivals and would go against (chastise) a president who overreached, even in their own party, to tell them to stay out of their dominion and stay in their lane.
The Federalist papers have some interesting things to say regarding parties, as they anticipated them. Federalist 10 especially. Some of it very prescient, some of it very naive. Worth a read regardless