|MadSci Network: Astronomy|
This is an excellent question, because it allows us to explore two different aspects of what we call "color". The quick answer, for anyone who doesn't want the detailed explanation, is that the sun is a "yellow" star by definition, regardless of where you are, but, if you look at it in space it would be so bright that it would appear white.
The first has to do with physics and the nature of the light coming from the object you're observing, and the second has to do with physiology and how your eyes and brain perceive that light.
Let's look at the first. Stars emit light and other electromagnetic waves (radio, microwaves, x-rays, etc.) all across the spectrum, including the entire visible spectrum. We describe electromagnetic waves by their wavelength in nanometers (billionths of a meter). Visible light ranges from about 400nm (violet) to 700nm (red).
When something emits light evenly across the entire visible spectrum (for example, there are equal amounts of red, blue, yellow and green light), we call that light "white". However, the light coming from stars isn't spread evenly over the visible spectrum. Though light of all colors will be coming from any one star, that light will tend to have a peak at one color. For example, our sun has a peak in the yellow range, so while it produces light of all colors, it produces more yellow light. To be more precise, stars produce light waves at specific frequencies (called "lines" because they appear as lines in a spectrum from a prism). Our sun has emission lines at several colors, but it has two very strong lines right next to each other at around 590nm, which is fairly yellow.
So our sun's light, though really spread across many colors, peaks in the yellow range; this is true whether or not you have the atmosphere between us an the sun. The peak of a star's light depends on the surface temperature of the star. If you're interested in that subject, I recommend a web site describing the Hertzsprung-Russel Diagram, which explains how astronomers categorize stars by their temperature, luminosity, size, and age. On the H-R diagram, our sun is a G-class (yellow to yellowish orange) star.
Your eye doesn't see the actual color of the light waves it receives. Instead, it has three types of "photo receptors", which produce a neural response when they intercept light of specific colors. The receptors are called "red" "green" and "blue", although those names are something of a misnomer. Any of them can detect most light that comes in. However, they each produce their strongest response when the light they "see" is closest to their color. For example, the red receptor produces a strong response when red light falls on it, a medium response when yellow or dark red light falls on it, and little response at all when blue light falls on it. Your eye figures out what color an object is by comparing the different responses of the red, green, and blue receptors. Soft yellow light causes a partial response in both the red and green receptors (yellow is in between red and blue in the spectrum), and a poor response in the blue receptors. So anytime your eye sees a bit of red and a bit of green in the same place with no blue, it thinks "yellow!". If your eye sees a strong response from all three receptors, it detects white.
The difficulty with the sun is that it is so bright, particularly in space, that it produces enough light to saturate all your receptors. Even though the sun produces more yellow light than blue light, there's still enough blue light to completely flood your blue receptor. Since all your receptors are overloaded, your eye can't actually tell that there's more yellow light than blue light (or red, or green, or orange). In the end you see white!
Another effect that may come into play is contrast detection. Your brain, after the eye does the red-green-blue color processing, tries to compare nearby colors against each other. Your brain compares white vs. black, red vs. green, and yellow vs. blue. You may have seen this effect in optical illusions - a grey square surrounded by white looks darker than the same grey square surrounded by black. Likewise, an object surrounded by blue will look slightly yellowish.
On Earth the sun looks mostly white, with a slight yellowish cast:
In space, you don't have the atmosphere. That changes parts 2 and 4, and maybe 3 as well.
Thanks, and keep submitting good questions like this one!
Try the links in the MadSci Library for more information on Astronomy.