White and gray hair can be kept from turning yellow by using non-yellow tinted shampoos and conditioners, avoiding chemicals in water and sunlight, dying hair and ensuring that there is not excess scalp oil. Excess scalp oil can cause the hair to take on a yellowish cast, so keeping the scalp reasonably dry if it is oily can help.
Another option is to dye existing gray or white hair. A person can go to a stylist and ask to have their white hair dyed a slightly different shade of white to help with any yellowish overtones.
Many people are unaware that the water that they drink can be changing the color of their hair. Water that has chlorine or other chemical residues can give hair a yellowish tint. Excess sunlight can also create a yellow tint in the hair.
If the person is using a yellow-based shampoo or conditioner, then that can also create a yellow tint in the hair. To solve this problem, it is recommended that the person start to use a clear shampoo and conditioner.
The reason why white and gray hair often turn yellow or start to pick up other tints, such as green or brown, is because white and gray hair holds very little to no pigment. This means that the hair can easily pick up other pigments through the environment that other hair colors, such as brown, red and blonde, might miss.