Adding lemon to lentils changes color from black to pink, why?
In the black lentils used in Indian cooking (Vigna mungo), the natural water-soluble dye that causes the color change has been identified as quercitin-3-O-pentoside:



which belongs to a class of compounds called flavonols. When you pop hydrogen ions on and off some of the -OH groups, you can get a pure benzenoid form (colorless), a quinonoid form (pink), and an extensive quinonoid form (yellow). The color changes
are pH dependent, and you get pale pink at pH &lt; 7, yellow at pH > 7, and
colorless at pH 7. When you add your lemon juice to the lentil water, you're getting the quinonoid form.

Other species of black lentils probably do something similar.

The pH-dependent color change occurs because when you have $-\mathrm{OH}$ groups on the rings instead of $-\mathrm{O}^-$ groups, the way electrons are confined changes; that changes the spacing between the molecule's energy levels, and changes the colors of light the molecule can absorb. (See my article here for more about how this works). 

Many plants and household materials contain molecules that can change color or otherwise indicate changes in pH (See my article here for a list of some of them). Almost any flower, fruit, or plant part that is red, blue, or purple contains a class of chemical compounds called anthocyanins that change color with pH. The color of a flower or fruit depends on which anthocyanins are present, the pH of the pigment-bearing tissues, and the presence of other pigments, like yellow flavones.