Dear student,
Pea is green due to the presence of chloroplast. Most of the fruits are green when unripe but becomes colourful due to enzymatic reaction changing the texture of fruit making it ripe. Similarly fruits and vegetables are of different colour depending upon the type of pigment they have. Chromoplast is responsible for different colours like red, orange, purple and blue etc. in fruits and vegetables. Therefore every fruit and vegetables are not green due to the presence of different pigment imparting different colour.
Regards