The intense purple color in string beans and snap beans (like Royal Burgundy and Dragon Tongue), yardlong beans (like Chinese Red Noodle), and hyacinth beans (like Ruby Moon) comes from plant pigments called anthocyanins.
This natural fluctuation in color occurs because anthocyanins are sensitive to the pH level of the “juice” inside the plant cells (the cell sap). The acidity of the cell sap is dependent on both genetic and environmental factors.
When it comes to purple beans, heat plays the principal role. Boiling, baking, or sauteing at high temperatures causes the anthocyanins to deteriorate. What’s left behind is green chlorophyll, which was always present in the beans but masked by the plant’s anthocyanins.
If you want to minimize color loss, you can blanch them, singe them on the grill, or toss them into a stir-fry at the end for a couple minutes. The color will fade a bit, but remain purplish.
All anthocyanins are tasteless, so they have no effect on flavor. But cooking your purple beans does destroy some of the anthocyanins available. You’ll reap the most nutritional benefits by eating them raw or cooking them very lightly. Just pick your purple beans when they’re small and tender for the best flavor and texture.