Asked by: Samantha Goodwin, Liverpool
When your skin is exposed to UVB radiation in sunlight, specialised cells called melanocytes produce the dark pigment melanin to protect the skin. Usually this melanin is produced evenly and results in a tan, but some gene variants, such as the MC1R gene that results in red hair, cause the melanocytes to overproduce melanin granules. This creates little pigment clusters that get darker in sunlight.
Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun facts.