Refraction and interference are due to the wave properties of light. Atoms in the star's atmospheres selectively absorb light at certain wavelengths. Atoms absorb light only at particular energies. This is explained by quantum mechanics. Thus, the specrum of a star is not continuous, but is marked by dark bands known as absorption lines.
Galaxies consist of stars and interstellar gas.
Most galaxies have spectra dominated by the combined light of all their stars. Because the stars have absorption spectra, so do these galaxies. Also, the absorption lines are broadened by internal motions in the galaxies. In some galaxies, the interstellar gases are glowing brightly. This happens in galaxies with lots of star formation.