Anthocyanin pigments, stored in the vacuoles of petal cells change color with pH (acidity). The Japanese Morning Glory, Ipomoea tricolor var. Heavenly Blue, changes color from purple to blue in the early hours of the morning (Figure A).
A section of the petal (B) shows the transition in color. Notice the change in cell volume (C) and pH (D) accompanying the color change. This is a caused by the induction of a gene, NHX1 that exchanges sodium or potassium ions for protons and regulates lumen pH. This gene was discovered serendipitously in my lab back in the '90's.
In humans, these same genes regulate pH inside synaptic vesicles and appear to be important for packaging neurotransmitters for release, and clearing them from the synaptic cleft. Mutations are linked to autism, addiction, ADHD and XLMR.