Acid can affect the color of certain dishes by reacting with pigments. In the case of green vegetables like spinach, acid degrades chlorophyll, causing it to turn olive green or brown.
The vibrant green color of many vegetables, especially leafy greens like spinach, comes from a pigment called chlorophyll. Chlorophyll is naturally stable in alkaline conditions. However, when exposed to acid, the magnesium ion at the center of the chlorophyll molecule is replaced by hydrogen ions. This process, known as pheophytinization, causes the chlorophyll to degrade and change color, typically to a dull olive green or brownish hue. This is why adding acidic ingredients like lemon juice or vinegar to cooking water can cause green vegetables to lose their bright color. To maintain the green color, you can cook vegetables quickly in boiling water, which helps to deactivate enzymes that contribute to color loss, and avoid adding acidic ingredients until after cooking.
To keep spinach bright green when cooking, blanch it briefly in boiling water and then immediately plunge it into ice water to stop the cooking process. This sets the color and prevents further degradation.