Melanin serves a few very important purposes besides giving your skin its color. When you’re outside, your skin is being exposed to the ultraviolet rays of the sun. UV radiation is just that--radiation--and prolonged exposure can damage the DNA of your skin cells. With enough damage, that DNA can start to malfunction and the life cycle of your skin cells is disrupted, potentially causing uncontrolled replication and leading to cancerous growths.
Your body’s looking out for you though, and has a couple of defense mechanisms in place. One of which is your melanocytes. Inside your melanocytes are little melanin-producing factories called melanosomes. If the mitochondria is the powerhouse of the cell, the melanosome is the powerhouse of the melanocyte. And there are two kinds of melanin produced by these melanosomes--eumelanin, a darker pigment, and pheomelanin, a light-colored pigment. Eumelanin blocks UV photons from damaging the skin, so those without a lot of it--people with lighter skin--are at higher risk of sun damage.