The purple, however, usually disappears when cooked, and leaves just a green colour behind.
Steaming it helps to preserve the purple colour when cooked; if you really want to boil it, add a few drops of lemon or vinegar to the water to help preserve the colour. Some strains will still turn green anyway when cooked.
Best used raw in salads to preserve the colour.
The purple colour comes from the same “anthocyanins” compounds that are found in red cabbage, red wine, etc. Some researchers believe that anthocyanins belong to the group of phenolic antioxidants, which may help to prevent cancer growth.