The absorption spectra of a dye or pigment can change with changing pH due to the ionization or protonation of functional groups present in the dye or pigment molecules. This change in the molecular structure can lead to alterations in the electronic transitions, which in turn affect the absorption spectra.When the pH of a solution changes, it can cause the dye or pigment molecules to gain or lose protons H+ ions . This process can lead to the formation of different molecular species, such as the acidic form protonated and the basic form deprotonated of the dye or pigment. These different molecular species can have distinct absorption spectra due to differences in their electronic structures.For example, some dyes and pigments contain functional groups like carboxylic acids -COOH or amines -NH2 that can ionize or protonate depending on the pH of the solution. At low pH acidic conditions , carboxylic acid groups will be protonated -COOH , while at high pH basic conditions , they will be deprotonated -COO- . Similarly, amine groups will be protonated -NH3+ at low pH and deprotonated -NH2 at high pH.These changes in the molecular structure can affect the energy levels of the dye or pigment molecules, leading to shifts in the absorption spectra. The absorption maxima max can either redshift shift to longer wavelengths or blueshift shift to shorter wavelengths depending on the specific dye or pigment and the nature of the electronic transitions involved.In some cases, the change in pH can also cause the dye or pigment to undergo a color change, which is the basis for pH indicators like phenolphthalein and bromothymol blue. These indicators have different colors in their protonated and deprotonated forms, allowing them to visually indicate the pH of a solution based on the color change.In summary, the absorption spectra of a dye or pigment can change with changing pH due to the ionization or protonation of functional groups in the molecules, leading to alterations in their electronic structures and resulting in shifts in the absorption maxima.