Why did the grape juice change color when an acid or base was added?

The grape juice changed color when an acid or base was added because of the presence of anthocyanins, which are a type of flavonoid. Anthocyanins are natural pigments that can be found in a variety of fruits and vegetables, and they are responsible for the red, purple, and blue colors of these foods. Anthocyanins are pH- sensitive, which means that their color can change depending on the acidity or basicity of their environment. In an acidic environment, anthocyanins appear red, while in a basic environment, they appear blue. This is because the structure of the anthocyanin molecule changes depending on the pH of the solution, which affects the way that light interacts with the molecule.

When an acid was added to the grape juice, the pH of the solution decreased, causing the anthocyanins to change from blue to red. When a base was added to the grape juice, the pH of the solution increased, causing the anthocyanins to change from red to blue. This color change is reversible, and the original color of the grape juice can be restored by adding the opposite type of acid or base.