If you take a natural light photo of the sun, you will find that it is actually white

Some solar filter and eclipse glass makers add a yellow or orange tinge to falsely represent the 'perceived' colour. We only ever see the sun when it is near the horizon, and those glorious sunsets have much more to do with atmospheric refraction than the real colour of the sun.
BTW, not much yellow in the moon, and guess where that light is coming from indirectly!
I've added a colour shot from 2004.