Melanin gives color to the skin, hair, and iris of the eyes. Levels of melanin depend on race and amount of sunlight exposure. Sun exposure increases melanin production to protect the skin against harmful UV (ultraviolet) rays. In addition, hormonal changes can affect melanin production.