Skin colour is determined by the amount of melanin a person has in their skin.
Melanin is a pigment present in the skin cells.
The amount of melanin varies with the geography of the place. A person's skin becomes tanned when it receives a lot of sunlight. This is because of the secretion of more melanin pigment in the skin cells on exposure to sunlight. The role melanin plays is to safeguard the skin cells from the harmful rays of the Sun by absorbing them and not letting them penetrate through the skin to cause damage inside.