Cells in the human skin produce a substance called melanin. When sunlight hits the skin, more melanin is produced. Melanin darkens the skin and is the cause of suntan. Most people tan evenly all over the body, but some people tan just in spots. These little islands of suntan are the cause of freckles.