As a kind of rough study, the screenshots below show 3 color themes used to syntax highlight XSLT. I've chosen XSLT as it poses a particular challenge because of the large number of language elements - and also because many developers describe it as ugly.
The number of colors used in the sample helps distinguish the different language elements, but it might prove distracting to a developer.
It helps to progress from cold to warm colors if possible, using cold colors for the more neutral parts of the language. An alternative is to shift from pastel shades to more vivid ones (hue saturation).
The background color makes a huge difference to the perception of the foreground colors.
Some adjacent foreground colors can cause bad clashes that disturb the eye, red and green in particular do not seem to go well together.
With a dark background it is easier to provide a wide range of foreground colors with sufficient contrast with each other and the background.
Lastly, external factors such as ambient light and the quality and calibration of the monitor make a huge difference.
It is best to use tools that provide an extensible way of setting color themes as it is unlikely that any single color theme will meet the needs of all developers, and even the same developer may frequently change their preference depending on a variety of factors.