According to Kirchoff's laws tenuous gas may emit lines if heated up and viewed sideways, but will
result in absorption lines if it partially obscures a continuum source (It will only partially obscure the sun, in this case, because its tenuous.)

So the rainbow spectrum of a star like our sun (type G2) is "disrupted" by lines because atoms in the atmosphere absorb at those wavelengths/colors.