While UV radiation can assist in the production of vitamin D, excessive exposure to UV can damage health. Evolution of skin color
Loss of body hair in Hominini species is assumed to be related to the emergence of bipedalism some 5 to 7 million years ago. Bipedal hominin body hair may have disappeared gradually to allow better heat dissipation through sweating. The emergence of skin pigmentation dates to about 1.2 million years ago, under conditions of a  megadrought that drove early humans into arid, open landscapes. Such conditions likely caused excess UV-B radiation. This favored the emergence of skin pigmentation in order to protect from folate depletion due to the increased exposure to sunlight. A theory that the pigmentation helped counter xeric stress by increasing the epidermal permeability barrier has been disproved.With the evolution of hairless skin, abundant sweat glands, and skin rich in melanin, early humans could walk, run, and forage for food for long periods of time under the hot sun without brain damage due to overheating, giving them an evolutionary advantage over other species. By 1.2 million years ago, around the time of Homo ergaster, archaic humans (including the ancestors of Homo sapiens) had exactly the same receptor protein as modern sub-Saharan Africans.This was the genotype inherited by anatomically modern humans, but retained only by part of the extant populations, thus forming an aspect of human genetic variation.
Human skin color ranges from the darkest brown to the lightest hues. Differences in skin color among individuals is caused by variation in pigmentation, which is the result of genetics (inherited from ones biological parents and or individual gene alleles), exposure to the sun, natural and sexual selection, or all of these. Differences across populations evolved through natural or sexual selection, because of social norms and differences in environment, as well as regulations of the biochemical effects of ultraviolet radiation penetrating the skin.The actual skin color of different humans is affected by many substances, although the single most important substance is the pigment melanin. Melanin is produced within the skin in cells called melanocytes and it is the main determinant of the skin color of darker-skin humans. The skin color of people with light skin is determined mainly by the bluish-white connective tissue under the dermis and by the hemoglobin circulating in the veins of the dermis. The red color underlying the skin becomes more visible, especially in the face, when, as consequence of physical exercise or sexual arousal, or the stimulation of the nervous system (anger, embarrassment), arterioles dilate. Color is not entirely uniform across an individuals skin; for example, the skin of the palm and the sole is lighter than most other skin, and this is especially noticeable in darker-skinned people.There is a direct correlation between the geographic distribution of ultraviolet radiation (UVR) and the distribution of indigenous skin pigmentation around the world.