From the book of customs and superstitions; How did it begin? by R. Brasch :

Blue for Boys and Pink for Girls

An explanation of the custom of dressing boys and girls in different colours is linked with their sex. Babies all look alike, and what better means of identifying them readily than by colours- blue for boys and pink for girls? THis colour scheme has been adopted all over the world. But who would ever suspect that in the blue ribbon tied up a terror-crazed past and a haunting fear of anxious parents, deeply concerned with their baby's future?

From the days of antiquity it was beleived that evil spirits hovered menacingly over the nursery. It was thought further that the evil ones were allergice to certain colours, of which the most potent was blue. It was considered that the association of blue with the heavenly sky rendered satanic forces powerless and drove them away. Even in our own time Arabs in the Middle East continue to paint the doors of their homes blue to frighten away demons. Thus, the display of blue on a young child was not merely an adornment but a necessary precaution.

Girl babies were regarded as vastly inferior to boy babies and it was assumed that evil spirits would not be interested in them. That is why blue was reserved for boys. Any distinctive colour for girls was deemed unnecessary.

Possibly later generations, unaware of the original cause of "blue for boys" but very much conscious of the neglect of girls, introduced for them the new pink-look.

European legendary tradition suggests another beautiful explanation of the colour scheme for babies. This tells that baby boys are found under cabbages whose colour - on the Continent of Europe - was mostly blue. Baby girls on the other hand, were born inside a pink rose.