A pH indicator is a substance added to a solution to measure the approximate pH visually. The color of the solution with a pH indicator depends on the pH of the solution. For example, an indicator could be red in an acidic solution, and blue in a basic solution. In a lab, pH indicators are commonly used to mark the end point of a titration. You may also find them used outside of a lab to measure the acidity of soil or water.
There are many pH indicators available and each indicator has a different color change at a different pH. A few examples of pH indicators include: thymol blue, phenolphthalein, thymolphthalein. For more pH indicators and their color changes, you can look at a pH indicator table.
The naturally occurring pH indicators in Figure 1, all have a color change that depends on pH, but the mechanism that causes the color change varies between them. The color of hydrangea flowers depends on whether aluminum ions are within their petals. In acidic soil, the aluminum ions in the soil can be taken into the hydrangeas petals turning them blue. On the other hand, curcumin, anthocyanins, and litmus are substances that change chemical structure when a change of pH occurs, and this change in chemical structure causes a change in color.
Figure 1 - Naturally sourced pH indicators.