Gender is a social construct. Babies don't have the ability, or even capacity really, to understand gender and state what gender they are. It is assigned to them at birth by their parents. (Unless they're radical enough to wait until the child is old enough to make their own decision... There's an article about this, I can't remember if I bookmarked it or not, I'll try to find it.) Sex, however, is what you are born with. It is biological to your core. Yes, you can take hormones and have surgery, but it will not change the fact that you are either XX, XY, XXY, XXX, etc. However, once you are old enough to understand your gender, it may or may not match your sex. However, babies are babies and frankly for a while, they really aren't going to give a crap what color they're wearing so long as they are warm and well fed.
Personally if I ever have a girl, I'm telling people not to buy me pink stuff. I don't like pink and unless my daughter says she wants something pink, I'm not going out of my way to give her pink stuff. (I mean, I won't get mad at pink, but I want her to have any and ALL colors, not just pink.) Also the whole culture surrounding gendering the wants of children is stupid.