When deciduous trees turn brilliant gold, orange, and red each autumn, it looks like the leaves are changing color. They’re partly revealing colors that were always there. The yellow and orange pigments - carotenoids and xanthophylls - exist in the leaves throughout the spring and summer. They’re just completely overwhelmed by the bright green of chlorophyll, the pigment plants use to photosynthesize.
As autumn approaches and days get shorter, deciduous trees prepare to shed their leaves. They stop producing chlorophyll, and the green pigment breaks down. As it does, the yellow and orange pigments that were there all along become visible. So those colors aren’t new - they’ve been hiding behind the green curtain for months.
Reds and purples are different. These come from anthocyanins, which trees produce fresh in autumn from sugars in the leaves. Anthocyanins seem to help protect leaves from damage during the final stages of nutrient withdrawal. Cool nights and sunny days make trees produce more anthocyanins, which is why some autumns are more spectacular than others. Different tree species also make different mixes - sugar maples turn brilliant red and orange, while aspens go gold, and oaks tend toward brown.