The assignment of a color to each sex serves the obvious purpose of distinguishing infants, who otherwise look pretty much alike.
But the particular choice of blue dates back to ancient times, when evil spirits purportedly plagued young children but could be warded off with certain colors. Blue, emblematic of the heavens, had an immanent power to dispel satanic forces.
Many Arabs in the Mideast continue to paint their doorways blue.
Since it was of paramount importance to protect little boys, they were clothed in blue, while little girls were left to fend for themselves.
Only much later did parents, somewhat guilty about the girls’ lack of identity, assign them precious pink.