1. The star's temperature: A star's color is directly related to its surface temperature. Hotter stars emit more blue light, while cooler stars emit more red light. Our Sun, with a surface temperature of about 5,500 degrees Celsius, is actually considered a yellow dwarf star.
2. Our atmosphere: Earth's atmosphere scatters blue light more effectively than red light. This is why the sky appears blue during the day. At sunset and sunrise, the light has to travel through more atmosphere, scattering most of the blue light and leaving behind the red and orange hues. The same principle applies to starlight.
3. Our eyes: Our eyes are most sensitive to green light, so even though the Sun emits a broad spectrum of light, our eyes perceive it as yellow-ish white.
So, while stars might appear yellow, especially to us on Earth, they are actually emitting a wide range of colors depending on their temperature. To see the true colors of stars, you'd need to view them from space outside the Earth's atmosphere!