Tanning is the skin's effect to ultraviolet rays. After skin is exposed to UV rays, cells called melanocytes produce the brown color melanin, which darkens the cells of the skin. This darkening of the skin cells is the skin's natural defense against further damage from UV rays.