These vegetables colour – and others – come from natural molecules called pigments, among which chlorophyll is responsible for the green colour. To keep it, beware of over-cooking: an over-stay in boiling water turns vegetables yellow which a rather sad-looking result in your plate.
To preserve, the ideal is to have a thermal shock. Indeed, plunging cooked vegetables in ice water allows to stop the cooking and “fix” chlorophyll’s properties. In the kitchen of professionals, this technique is called “British cooking”. This technique is the one used on a wider scale at Bonduelle for frozen vegetable production such as green beans.
For cooking green vegetables ideally (fresh or frozen):
Adding bicarbonate of soda in water also allows vegetables to keep their green colour. However, it has the inconvenient to makes them go a bit soft which is less enjoyable when eating.