When skin is exposed to the sun, melanocytes produce more pigment. This causes the skin to tan, or darken.