Wait, where do you live? In Australia, school uniforms are the norm, in every school both private and public. I think it's similar in the UK. But you said it was more of a "dress code" and not a "uniform", so I'm going to assume you're in the US (if you're not forgive me).
The school probably does have a right to introduce a dress code, so long as it is not too onerous or difficult to obey. However, limiting what colours you can wear is a bit much. I don't think that's fair at all - what if you don't have any clothes in that colour?
I went to a private school and I had to wear a uniform. We also had rules restricting what hair cuts we could have, the colour of the hair and what earrings/rings girls could wear. Some of it was sensible, some of it was stupid - girls, for instance, had to wear skirts, even in winter. Then again, winter doesn't get too bad here, so it didn't cause that much of a problem for them, I assume. We also had to wear hats all the time.
Of course, the rules were spottily enforced. The pacific islander kid who got into the school on a government scholarship was given endless grief over the most minor of infractions, and was eventually expelled one day before graduation. Ouch. While the incredibly wealthy, blond ex-South African girl was allowed to dye her hair, wear her skirt up and have multiple earrings and basically flaunt the rules without trouble. I swear she was paying the teachers off.
But it's been a long while since I was in school, and I have to say that looking back, dress codes didn't really cause that much of a problem for anyone. You can still express yourself, you've just got to do it by other means. For instance, I wore my blazer all the time, every single day, no matter the temperature. I wore it even during 40 degree Celsius days. I simply refused to take it off, no matter what. Teachers were puzzled, the staff were concerned, but there was no rule saying I couldn't wear it.