"Human skin color reflects an evolutionary balancing act tens of thousands of years in the making. There’s a convincing explanation for why human skin tone varies as a global gradient, with the darkest populations around the equator and the lightest ones near the poles. Put simply, dark complexion is advantageous in sunnier places, whereas fair skin fairs better in regions with less sun.
That may seem obvious, considering the suffering that ensues when pale folks visit the beach. But actually, humanity’s color gradient probably has little to do with sunburn, or even skin cancer. Instead, complexion has been shaped by conflicting demands from two essential vitamins: folate and vitamin D. Folate is destroyed by the sun’s ultraviolent (UV) radiation. Whereas the skin kickstarts production of vitamin D after being exposed to those same rays.
Hence, the balancing act: People must protect folate and produce vitamin D. So humans need a happy medium dosage of sun that satisfies both. While the intensity of UV rays is dictated by geography, the amount actually penetrating your skin depends on your degree of pigmentation, or skin color.
That’s the basic explanation, proposed in 2000 and fleshed out since by anthropologist Nina Jablonski and geographer George Chaplin. But for the full story of skin color, we’ve got to go way back to hairier days."