Cells called melanocytes that lie deep in the epidermis produce a pigment, called melanin, that gives skin its color. Exposure to ultraviolet light—from the sun or a tanning bed—causes melanocytes to produce more melanin, which they pass along to the skin cells above them, yielding a suntan. But why would sun exposure prompt this increased melanin production? What is the function of a tan, in other words?