Melanin helps protect from DNA damage by absorbing much of the UV radiation. As you get more exposure to sunlight, your skin produces more melanin resulting in more protection.