Sunlight can be broken into its constituent colors using a prism. The colors are the optical spectrum of the Sun. They are the same colors on rainbows. On careful observation, the spectrum is not perfectly continuous, but it has dark lines scattered over the entire spectrum. It turned out that from the lines, we can tell the composition of the Sun without physically getting there.
Some flat-Earthers think that it is impossible for us to determine the composition of the Sun, as it is impossible for anyone to visit the Sun without getting roasted in the process. They are wrong. The composition of the Sun can be determined from the spectral lines, or more specifically for the Sun: the Fraunhofer lines.