Melanin is a pigment that is responsible for colour in humans (and also in many other organisms). The most common places in the human body where melanin shows its presence are skin, hair, iris, etc. The skin contains special type of cells called melanocytes. These cells produce melanosomes, which contain the melanin pigment. Melanosomes protect the nucleus of skin cells from the ultraviolet rays, which may cause mutations and lead to cancer (eg. melanoma). Among the melanin pigments, eumelanin and phoemelanin are the two important pigments that are responsible for the variation of skin colour in human beings. The increased content of eumelanin provides dark colour; whereas, the increased content of phoemelanin provides light colour to the skin. Hence, the proportion of these pigments determines the colour of the human beings. Melanin involves in the protection mechanism when exposed to UV radiations to prevent DNA damage. Exposure to high amount of UV radiations may lead to melanogenesis, increased level of melanin in the epidermis (outer layer of skin) and darkening of the skin (usually called as sun tanning).
We can understand our human system with the help of Science.
(A snippet from our current book, You, Me & Evolution)