Clive Ronson, a geneticist at Otago University's School of Medicine, responded.

Differences in hair and skin colour between people are due to differences
in the amount and type of a chemical called melanin (the same chemical
that allows some of us to go brown after exposure to the sun), and the
way it is packaged into hair and skin cells. Melanin is a complex
mixture of related chemicals and is produced in special cells called
melanocytes. The melanocytes secrete melanin into keratinocytes, the
cells that form hair fibres, and also into skin cells. Melanin is of
two main types: eumelanin which is brown or black, and pheomelanin,
which is yellow or red. The relative absence of both melanin types is
associated with white hair; more eumelanin than pheomelanin with brown
or black hair; and more pheomelanin with red hair.

The MC1R (melanocortin 1 receptor) gene encodes a protein that, when
activated by hormones, causes an increase in the ratio of eumelanin to
pheomelanin, leading to brown or black melanin at the expense of yellow
or red melanin.

Differences in hair (and skin) colour between people are one of the
most striking human characteristics. These differences are largely
inherited and hence under genetic control. Surprisingly we dont know
much about the genetics of hair colour in humans and it needs more study.
We do know that red hair is a recessive trait, meaning that particular
variants of MC1R need to be inherited from both parents to give a high
chance of having red hair.

Similar diversity in the MC1R gene is known to underpin hair and skin
colour changes in a wide range of animals, including dogs - for example,
Red Setters are red and Golden Labradors golden due to the same MC1R
variant causing an excess of pheomelanin, with other genes determining
the red versus the gold.