What chemical occurs to the red cabbage red for acids and blue for bases.

Red cabbage juice contains anthocyanin and can be used as a pH indicator. It is red, pink, or magenta in acids, (pH < 7), purple in neutral solutions (pH ~ 7), and ranges from blue to green to yellow in alkaline solutions (pH > 7).