Distribution of star colours in a galaxy I'm trying to randomly generate a representation of a galaxy.
I have some Idea on the spatial distribution of stars within a galaxy, and I can find plenty of material on the colour of stars, but nothing that seems to give either the distribution of numbers of stars by colour or (if any exists) spatial distribution by colour.
Are there any models for distribution of the colour of stars in a galaxy either by frequency or by location within a galaxy? What do these models depend on? galaxy age? type of shape of galaxy?
 A: The color of a star depends on its mass and temperature. The distribution of these also depends on the age of the galaxy. When the galaxy is very young, there are large amounts of gas still available for star formation, and many young, heavy, hot stars mean that the galaxy is very bright and shines in bluer light. This can be seen as an analogy of the quick flare just when you strike a match. These stars have a short life span and soon die, and as they quickly spend a large part of the available gas in the galaxy, the star formation activity decreases.
With lower star formation and the most of the very massive stars already gone in a fireworks of supernovas, the older galaxy appears redder. This partly due to the fewer blue stars, but also because many more of the low-mass red dwarfs - which form slower but live much longer than the massive, bright blue ones - have accumulated. The galaxy also gets a growing contribution from the heavier main-sequence stars turning into red giants, but this contribution is quite small not always so small, it turns out (*).
How this evolution is going is quite complicated. There are some pretty well-trusted models for the mass distributions of stars in young, star-forming galaxies, called the initial mass function. So the one simplified approach could be to draw a random sample from this distribution and from their masses determine their spectral type and hence their color. But this distribution is only valid at age zero; the mass and hence color distribution is subject to significant evolution over time. Unfortunately, this evolution is not simple, and much of it is still unknown. We don't know, for example, if young galaxies have a period of steady star formation, form most of their massive stars in a single or a series of bursts, or something else.
Also, the evolution is not smooth, as collisions and mergers between galaxies have a heavy influence on Star Formation Rates and hence mass and color distribution. Such collisions and mergers have been found to be very common in the local Universe, and probably much more so in the early Universe.
We can say one thing, though: the Milky Way stellar mass distribution seems to be relatively typical for galaxies at our stage of evolution; that is, a medium-large spiral galaxy with a steady but not strong star formation activity. Later, the Milky Way is likely to merge with first Andromeda and later other galaxies, which will probably trigger more star bursts and later deprive the new supergalaxy of almost all its gas. At this point, it will become an elliptical galaxy with few blue stars and many more red stars, and much less dust and gas than it has today.
So, to answer the question:
You first need to determine what type of galaxy you want. If you want a young, star forming galaxy, one of the initial mass function mentioned on Wikipedia should be just fine, and this will also be the simplest solution. If you want smaller starburst galaxies, gas-rich Milky Way-type galaxies or large, red, gas-poor elliptical galaxies, you should probably try searching the literature for mass functions to use - see for example

A. Tamm, E. Tempel, P. Tenjes, O. Tihhonova, T. Tuvikene. Stellar mass map and dark matter distribution in M31. Astron. Astrophys. (accepted). arXiv:1208.5712 [astro-ph.CO].

Once you have found your mass function, I'd draw a random sample from this, and from the masses determine the spectral type. This is actually not possible to do without a full-fledged numerical stellar model, but if you limit yourself to main-sequence stars, there are some approximations you can use here and in the Wikipedia entry for the mass-luminosity relation. This should (although I haven't had the time to double check) give you the temperature of the star from the mass, from which you can infer the color by using Wien's displacement law.
In short, there is no easy way to do what you want, but I hope I have sketched a way to do it not-too-wrong.
(*) From a remark from a professor at our department during a Ph. D. Thesis defense today.

Edit:
This paper seems to have something that could be practically useful as to the evolution of the Mass Function (i.e. the mass distribution) over time. This is for galaxy clusters, not for individual galaxies, so the result is, you could say, "unrealistically typical", but should be a good start:

Guido De Marchi, Francesco Paresce, Simon Portegies Zwart.
The stellar IMF of Galactic clusters and its evolution.
arXiv:astro-ph/0409601

Edit again:
For the Milky Way, this table shows how large fractions of the main sequence stellar population the different spectral types make up (found in this question).
