Why do the trees can have green, orange, red or purple leaves?
The different coloration on leaves is because of the chromoplasts. They exist in leaves, fruit and petals, to which they give their distinctive colors. Chromoplasts synthesize and store pigments, this pigments can be:
Carotene = orange
Xanthophylls = yellow
Chlorophyll = green
Anthocyanins = red, purple, blue (depending on the pH since they are water-soluble vacuolar pigments).
The probable evolutionary function of chromoplasts is to act as an attractant for pollinating animals or for seed dispersal via the eating of colored fruits. When leaves change color in autumn, it is due to the loss of green chlorophyll unmasking these carotenoids that are already present in the leaf.