One of the most common concerns regarding mucus is a sudden change in its color. If your mucus is yellow then it is an indicator that you might currently be suffering from an infection. You will have seen the warning signs in the form of clear, runny mucus and noticed that it has begun to thicken and darken over time. The colouring is not caused by bacteria though, but by your own immune system. As bacteria begin to build up in your nasal area, your body orders your white blood cells to your nose so that they can begin to fight off the infection. As you are no doubt aware, fighting an infection can be a lengthy process and many white blood cells are created and killed during this time.
The large quantities of dead white blood cells are then flushed out of your body, along with the dead bacteria, using the mucus as a waste system. These dead white blood cells are what lend the mucus its yellow colour, as the cells start to break down in the mucus. As the quantities of white blood cells increase, the mucus will eventually become green due to the enzymes excreted by your white blood cells as a defence mechanism.
So, instead of being a sign that something is going terribly wrong with your body, yellow mucus actually means that your body is doing its job perfectly. That being said, as the substances produced in your nasal cavity are water based, a thickening of the mucus can mean that you dehydrated. This can easily happen during infection, as every cell produced by your body requires water and your immune system needs all the help it can get. For this reason, while it is important to stay hydrated at the best of times, special care should be taken to ensure adequate hydration when fighting off an infection.
Alternatively, discoloration of your mucus can be down to atmospheric changes, which may be due to the seasons changing or you moving location. If you live in an area with lots of oak trees, for instance, your mucus may become yellow due to the oak pollen and your mucus will be darker if you live in an area with lots of smog. It is performing its function as a filter. If the mucus has a bad odor, along with a yellow color, then it probably is an infection. Either way, the discoloration is proof that your mucus is taking care of you.