The key to maintaining natural anthocyanin coloration is to keep fruits and vegetables sufficiently acidic, and avoid supplying trace metals. Lemon juice in the cooking water or sprinkled on the food can help with both aims: its citric acid binds up metal ions. Cooking red cabbage with acidic apples or vinegar keeps it from turning purple; dispersing baking soda evenly in batters, and using as little as possible to keep the batter slightly acidic, will keep blueberries from turning green.