What determines the autumn leaf color?
There is no color code for the leafs - the color results from biochemical reactions. Basically there are three colors: Green, yellow and red.


Green color is caused by the chlorophyll inside the chloroplasts,
when the leafs are active in photosynthesis.
Yellow color is caused by Carotenoids, which are present in the
leafs all the time, but are masked by the chlorophyll. The
carotenoids become visible when the amount of chlorophyll in the
leafs is reduced, which usually happens in the fall.
The red color is caused by Anthocyanins, which are usually not
present in the leafs. They are made during the late summer and can
also mix up with the carotenoids (color mix) to get intermediate
colors.
Brown color is caused by the cell wall of dry leafs which have no
other color.


For further reading these articles are interesting:


Unravelling the evolution of autumn colours: an interdisciplinary
approach.
The Science of Color in Autumn Leaves


There is also the hypothesis around, that the bright colors are a warning sign to insects, this is called the co-evolution theory of autumn colors. The color should warn the insects that the tree has a high level of defense and thus reduce its parasitory load. You can read more about this hypothesis here: 


The coevolution theory of autumn colours.
The shared and separate roles of aposematic (warning) coloration and
the co-evolution hypothesis in defending autumn leaves.