The findings, published in Nature Genetics, could also help forensic scientists use DNA samples to identify the natural hair colour of unidentified criminals.
In the largest ever genetic study on pigmentation, which includes skin and hair, researchers analysed DNA data from almost 300,000 people of European descent.
By comparing self-reported hair colour with genetic make-up -- stored at several million locations across the human genome -- the team identified 124 genes involved in the development of hair colour.
Inherited factors account for 97 percent of colour variation for hair and skin, but only a dozen relevant genes had been previously identified.
"The link between pigmentation and health is very important in the evolution of the human race," said co-author Veronique Bataille from King's College London.
"Knowing more about these genes can be important not just for skin cancer but also for other conditions, like auto-immune diseases."
Other pigmentation-related diseases include testicular, prostate and ovarian cancers, as well as Crohn's and other forms of bowel disease.