Before modern times it was not so easy to give colour to a cloth or uniform… Blue, and red, are the most easy to dye, and fade very slowly that’s why they are the most common colours in medieval heraldry. Yellow is nice if you are rich enough to use golden thread. Green was unstable — French Foreign Legion generals complained about it in the mid-19th century, it changed colour in the sun or rain; and orange also was unstable — that’s why the modern Dutch flag includes red instead of the original orange (which faded at sea).
And I’m talking about wool (or silk). It was very difficult to dye cotton or linen properly before modern times.