They get the purple color because they are rich in antioxidants called Anthocyanin. This antioxidant is responsible to give the vibrant color in so many veggies, like purple sweet potatoes.