There are different reasons for gray hair and not all are genetic. Well, actually, that's not completely true. Genes have switches that are activated or de-activated based on different factors, and hair pigment works on switches. The switches for hair pigment relate to nutrition, stress levels, and hormone levels. And yes, in a lot of people it's just a time-activated thing that comes with aging and there's nothing you can do about it.
Colour can disappear if nutrition has suffered, if a person has experienced long-term stress or trauma (adrenals), if they ejaculate way too often (in men, this is called essence deficiency), etc. About essence... the modern understanding is that the more often you ejaculate, the more androgens are released in your body to compensate; and just as some bald men had baldness switches in their genes that were sensitive to an influx of aldosterone, the same is true with gray hair in those susceptible.
The Chinese herb he shou wu (polygonum multiflorum) can reverse gray in some people, especially those with deficient type constitutions. I've used this on patients for other things and a side effect has been their hair colour returning, so I know it works for that. Just make sure you're using the prepared version and not the raw version. The raw one is to increase bowel movement, but the prepared one is for nourishing blood and essence.