You're likely thinking of the book
"Matilda" by Roald Dahl. In the book, Miss Trunchbull, the headmistress, is described as having
"spittle as thick as pea soup".
This doesn't tell us the colour of the spittle, but we can infer that it is likely yellowish-green based on the comparison to pea soup.