From a history of gendered colors:
Pink and blue arrived, along with other pastels, as colors for babies in the mid-19th century, yet the two colors were not promoted as gender signifiers until just before World War I—and even then, it took time for popular culture to sort things out. For example, a June 1918 article from the trade publication Earnshaw's Infants' Department said, "The generally accepted rule is pink for the boys, and blue for the girls. The reason is that pink, being a more decided and stronger color, is more suitable for the boy, while blue, which is more delicate and dainty, is prettier for the girl."
Lucinda Rosenfeld delves into the fascination children have with colors:
"If people want children to act in a calmer way, they should go with blue or another cooler color," [Marilyn Read, an associate professor of design and human environment at Oregon State University] advises. Even little girls’ love affair with the color pink—forever the object of much hand-wringing by parents uneasy with the message it sends—may be innate. "Pink is a color that makes us hungry. It’s also a color that boys like until they’re told not to like it," says Read, who notes just one case in which gender differences in color preference might be nature not nurture: Some researchers suggest that boys tend to prefer yellow-based reds (think: tomatoes), while girls prefer blue-based reds (think: rubies). Both boys and girls tend to dislike orange.