pH-Induced Changes in the Molecular Structure and Color of Anthocyanin Dyes

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Cyanidin is a typical anthocyanin molecule found in red cabbage juice, fruits and flowers. This Demonstration shows how its molecular structure changes according to the pH of the surrounding chemical environment. As a response to this microscopic change, the color of the anthocyanin solution is also affected [1, 2]. This pH-responsive phenomenon, called halochromism, is why these compounds are used as natural pH indicators. Their color range can span from red (i.e. acid solutions with pH ⪡ 4) to yellow (extremely basic environments with pH ⪢ 7). As a further application, this property can be used to monitor the quality and safety of packaged food [3, 4] by using anthocyanins as dyes. Natural pH indicators such as litmus paper can exhibit different color scales depending on pH.


You can tune the pH from 1 to 14 by using the "pH indicator gauge" slider; the color scale chosen for cyanidin is displayed by the fully customized BulletGauge indicator shown in the upper part of the output section alongside the chemical nomenclature for the molecular ionic species (e.g. flavylium cation). The corresponding molecular structure is shown in the lower part according to the selected options (2D or 3D visualization, with or without indices and with or without hydrogen atoms in the 2D molecular plot).

The corresponding molecular structures have been plotted starting from the corresponding Simplified Molecular Input Line Entry Specification (SMILES) reported in the Initialization section. Since it is not easy for chemoinformatics beginners to devise the correct SMILES string for complex organic molecules like anthocyanins, the AI-based web application Decimer [5] has been used to associate the correct SMILES string to the screenshots of molecular structures depicted in the references.


Contributed by: Jessica Alfonsi (August 27)
(Padova, Italy)
Open content licensed under CC BY-NC-SA


[1] Wikipedia. "Anthocyanin." (Aug 11, 2023)

[2] German Wikipedia. "Cyanidin." (Aug 11, 2023)

[3] R. Priyadarshi, P. Ezati and J.-W. Rhim, "Recent Advances in Intelligent Food Packaging Applications Using Natural Food Colorants," ACS Food Science & Technology, 1(2), 2021 pp. 124–138. doi:10.1021/acsfoodscitech.0c00039.

[4] R. Abedi-Firoozjah, S. Yousefi, M. Heydari, F. Seyedfatehi, S. Jafarzadeh, R. Mohammadi, M. Rouhi and F. Garavand, "Application of Red Cabbage Anthocyanins as pH-Sensitive Pigments in Smart Food Packaging and Sensors," Polymers, 14(8), 2022 pp. 1629–1649. doi:10.3390/polym14081629.

[5] "Decimer." (Aug 11, 2023)


Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.