Red cabbage contains anthocyanin (actually more than one) which is a plant pigment that will change color with changes in pH. It is easy to extract [local] the pigment. This has become a favorite experiment [local]ranging from elementary school to college to test the pH of many household chemicals. Red cabbage indicator experiments can be displayed [local] to show the variability of color with varying pH.
Black beans have considerable amount of anthocyanin in their seed coats. A common extraction of anthocyanin is ethanol:HCl (99:1). Black beans are reputed to work well as indicators.
Red cabbage is not the only plant containing anthocyanin. Read about grape juice and indicator art [local].