If galaxies are composed of stars, then to reproduce the fluxes, colors and spectra of galaxies, one only need to add up a library of stellar spectra with some understanding of the mass or luminosity function of stars in a galaxy.

The luminosity function appears to derive from physics of star formation from large clouds of gas (for example, larger number of small, low mass fragments versus large, high mass fragments).

A complication arises from the fact that stars evolve and dramatically change their luminosities, colors and spectral features with time.