We used to log “Sun-likes” with a garage telescope, a Commodore 64, and a lot of guesswork. If it looked yellow and didn’t blink, it made the list. Half of them were porch lights, but we stood by our catalog.
The reason for this is not mentioned there, which is that the atmosphere of the Earth acts like a low-pass filter for the direct light that comes from the Sun or from a star, converting the white light into yellowish light. The missing bluish light is diffused over the sky, giving it its blue color. The night sky is also blue, but at a many times lower luminance, so that it seems black.
On the Moon, the Sun will appear as perfectly white, on a perfectly black sky.