Hi,
The sun gives out a whole range of colors, which ends up meaning it is effectively white.
White is what you get when you combine all the colors of the rainbow (or when you split up the white light of the sun into all its colors).
People think of the sun being yellow or orange mostly because it tends to look that way at sunset amd sunrise. This is because the light from the sun at those times is passing through a lot of Earth's atmosphere before it reaches you. The atmosphere scatters the blue light (giving us our blue sky) and leaves the redder light behind.
When you spread the light of the sun into its different colors the result is called a spectrum.
Here is a spectrum from the Sun
. Studying these spectra can tell us things like what the Sun is made of and how hot it is.
Terry