Yellow phlegm in the throat is due to illness but yellow saliva is not necessarily. Certain yellow colored foods can cause yellow saliva. Foods with food coloring and yellow spices do this. But it's easy to tell these apart because yellow phlegm has a thick consistency and comes from the back of the mouth. Yellow saliva is thin. The yellow color in saliva from foods goes away in a very short time.
Once I got yellow saliva from yellow colored candies.