Different skin colors evolved over thousands of years as people migrated to different parts of the world. Those who lived closer to the equator developed darker skin tones, while those who lived closer to the two poles developed fairer skin tones. This is because UV rays trigger an immune reaction in the skin, which produces more melanin (pigment) to protect itself from UV radiation.