I found this on line:

As we grow old, our hair bulbs lose the capacity to produce melanin that determines the color of our hair. The change in pigmentation that comes with age is really the reason why hair turns from gray to yellow. The melanin granules in our hair break down and the underlying pigment, which is essentially pale yellow, comes out. Having said that, it's also other external factors that are responsible for gray hair turning yellow. Hair starts to appear yellow when direct sunlight or free radicals and air pollutants interact with the natural chemicals in them. Water in particular also can be one of the main reasons. If the water you wash your hair with is hard or rich in iron, the chemicals leave a deposit on the shaft of the hair. So, using distilled water to wash hair always helps. Then, of course, active or passive smoking, medication, hairsprays can also cause gray hair to turn yellow too. At times it's the oxidizing caused by hair iron, curlers or rollers that makes silver hair to look yellow. One's diet also plays a huge role. Food high in sulfur or even medicines with sulfur concentrations can have this effect. In some cases it's B-12 deficiency or thyroid imbalance that make hair to turn yellow.

To prevent hair from turning yellow, one must cover hair with a hat or a scarf when out in the sun. Adding a layer of protection by applying moisturizer in hair when going out also helps. It's also advised to change the shampoo in three to four months so that there is no shampoo build up. Brassy, yellow look can be gotten rid of from the hair by choosing a highlighting shampoo that has a cool base color like blue or violet, specifically shampoos containing vegetable dyes. Apply the shampoo to wet hair, work up lather and let it stand for about 5 minutes. You can also rinse your hair with lime juice regularly to get rid of the yellowness. Mixing baking soda with shampoo and rubbing it on hair for a couple of minutes and rinsing it off will get rid of the deposits. Follow this just once a week so that the hair doesn't get dry. Another way is rinsing hair with 1 tablespoon Vinegar added to 1 cup filtered water. Also including eggs, soybean, peanut, walnut, black sesame, proteins prevents the yellowing of gray hair.