There shouldn't be any issue. However, there are a few paths here based on some unknowns:
Can differently colored plants interbreed?
If they can, then it's likely that they will mix genes to a point of turning into an averaged color over millions of years. You'd expect the color to fade towards the predominant color mix.
Are differently colored plants found in the same region, or are they separated?
If they're separated, then the color muddying won't happen as fast, but it should eventually still happen (birds carrying seeds, humans traveling, even the wind would carry an errant seed now and then.
Are there notable survivability differences between the plants?
If, for example, pink plants need less C02 than green plants, they're capable of living in areas with less C02 prevalence.
In areas where green plants can survive, pink plants would have excess resources that they can dedicate to growing larger in size. This can be a cause for slightly varied plant life: pink trees, green shrubs.
Different survivability factors can be a cause for the separation. Inventing some traits to prove the point:
- Pink plants need less oxygen => High altitude locations are predominantly pink.
- Orange plants dramatically drop in efficiency in the cold => The tropics are predominantly orange.
- Blue plants die in warmer environments => Cold regions are predominantly blue.
And so on. The separation doesn't need to be perfect, i.e. other colors can still exist in the same region, but you'd expect a particular color of plant with a particular genetic "skill" to be more prevalent in the region that matches said skill.
But if they can interbreed, and they're in the same region together, they will over time mix their genes enough to lose their individual distinct qualities (including color).
I notice you mentioned:
I don't see how pigments could "occupy different ecological niches", because their job is just to absorb light.
But that is somewhat contradicted when you said:
On Earth, all plants are green because ... containing different pigments, especially since green is an non-optimal colour.
If you extend your observation that green is non-optimal yet ubiquitous, you will find that just because a trait is predominant doesn't always mean that it was the key to the creature's genes increasing their evolutionary prevalence.
How did green become the predominant plant color, if it's not the most optimal color? Because the ancestor plants that were the best survivors just happened to be green. They were optimal species for reasons other than their color.
Similarly, the plant color traits I mentioned are not necessarily caused by the color. Maybe the cold-resistant plants just happen to be blue. Maybe the low-oxygen plants just happen to be pink. There is no inherent requirement for one trait (e.g. survivability factor) to be caused by the other (e.g. color. They can be coincidental.
And this is how different colors could occupy different niches:
- Initially, there are several colors of plants occupying the same niche.
- Let's assume these plants do not interbreed.
- Over millions of years, one species of plant has adapted to the niche better than any of its competitors.
- Over another million years, this plant slowly takes over the niche and basically turns into a monopoly. So far, it has maintained that monopoly.
- This plant just happens to have a certain color.
In other niches, the same thing has happened, but because one niche has nothing to do with the other, the second niche's monopoly ca be maintained by a plant of a different color.