Generally speaking, these substances are organic compounds (weak acids or bases), with high MW, that, according to the pH, are dissociated or undissociated.
The two forms have different colours because of interactions with H+ and/or -OH, such as, above all, those which produce conjugated double bonds in presence of a chromophore.