Species adapt to their environment to maximize survival. Our skin tone underwent such a process, but this was the result of years of evolution and natural selection.
According to the evidence we have, modern humans (homo sapiens) originated in Africa. Groups of humans started to gradually move throughout the rest of the continents, away from the equator with the blazing sun. Although the sun’s UV light can be damaging to our skin cells, that same light plays an important role in producing vitamin D required for healthy bones and strong immunity. In regions like Africa where the sun is very strong, high melanin and dark skin were vital to protect our ancestors from UV but allow enough of it to go through the skin and stimulate vitamin D production. However, as our ancestors migrated north, sunlight became weaker and was unable to dodge the protective melanin to induce our skin to make vitamins. This put our ancestors at risk and natural selection began to select individuals with lighter skin; only humans with lower levels of melanin were able to produce vitamin D. This variation in skin tone was actually an evolutionary response that took years to manifest!