As with any aspect of plant biology, chilli ripening is a complicated process.
In fruit cells, chlorophyll molecules absorb blue and red light, resulting in the reflection of green light (which is why the fruit are green) Also, the fruit contains lower amounts of anthocyanins and carotin, which reflect yellow and red/purple, respectively. During the active growth phase, chlorophyll predominates and fully obscures other pigments in the majority of plant species.
Chlorophyll is unstable and must be regularly replaced during a plant’s lifetime. As summer moves to fall, shorter days and cooler temperatures induce the creation of a water-resistant, cork-like substance (suberin) between the cells of the fruit’s stem. This layer gradually restricts the passage of nutrients into the leaf, preventing the formation of chlorophyll.
Additionally, shorter days and cooler temperatures stimulate the plant to create ethylene (a simple gas), which in turn stimulates the development of several enzymes. These enzymes have multiple purposes in the fruit. One of these processes is the conversion of starches into sugars, which explains why ripe peppers are sweeter than their green counterparts. Other processes include the breakdown of pectin (the glue between fruit cells), which softens the chilies (giving them a ripe texture), and the breakdown of acids, which eliminates the sour flavor that green fruit can have.
With a loss of nutrition, chlorophyll degrades, allowing previously dominant carotene and/or anthocyanin colors to become visible. As a result of a secondary action of simple sugars in the presence of light, the anthocyanin content of certain peppers is quite high (which is why fruits ripen red, orange or purple on the sunny side). When chlorophyll breaks down, the leaves of chillies with a high anthocyanin content become red or purplish red.
Similar to an artist mixing primary colors on a palette, the presence of the two main groups of pigments – flavonoids, including anthocyanins, which give yellow through red to blue, and carotenoids, carotin, which give yellow through orange – is comparable to the mixing of primary colors on a palette. The resulting pigments include cyanin (red), pelargonidin (brick red), delphinidin (blue), etc.
Anthocyanin is remarkable because, depending on the pH of the liquid within pigment-containing cells, it produces a variety of colors. The same pigment molecule imparts a blue hue to Purple Tiger peppers with alkaline cell contents and a red hue to Jalapenos with acidic cell contents.
The color may remain nearly constant throughout the duration of the pepper’s life, or it may undergo dramatic changes. As birds are not harmed by the capsaicin heat, this serves as an indicator to birds that the green chilli is ready for consumption.
I hope this has clarified the maturation process of chilies and why they can take on such a wide variety of colors.