Your skin colour is affected by how much pigment, or melanin, is produced by your skin cells. More melanin means a darker shade of skin, less means fair skin. If you spend a lot of time in the sun, your body will make extra melanin in order to protect the skin, darkening it. The result is a suntan.