The compounds that give fruits and vegetables their red color are very sensitive to acidity. As long as they are acidic they stay red, but when they become non-acidic they turn blue. When you sauté red cabbage, the acids evaporate off and it can turn blue. All you have to do is add lemon juice or vinegar to bring back the bright red color.
For this same reason, you may have seen a blue circle around the cherries in cherry muffins. To prevent this discoloration, add a little lemon juice or use an acidic ingredient like sour cream or buttermilk in the muffins.
Even walnuts have some of these compounds just under their skins so walnuts can discolor a dish or give it a blueish cast. It is easy to prevent this discoloration from walnuts -- just roast the nuts before using. The temperature in roasting is high enough to convert these compounds to others that do not change color.
Shirley O. Corriher is a writer, author, biochemist, teacher and lecturer. She writes a column for The Los Angeles Times' "Great Chefs" series as well as articles in the Journal of Biological Chemistry. Her book Cookwise: The Hows and Whys of Successful Cooking is received a James Beard award.