Hypothetically,if our sun was yellow would we still be able to see white colour on objects like snow,cotton etc.? Would we have the phenomenon of rainbow?
Every "normal" star, produces a more or less "black-body" spectrum, at some temperature (more-or-less because there are brighter and darker lines caused by specific elements in the upper layers of the star), so there will always be a range of colours of light (or electromagnetic radiation at least) in its light, which can be spread to give a rainbow.
A white object (like ice crystals, or bleached cotton) reflects all colours of light more or less equally (over some range of wavelengths of interest, anyway).
So, if the Sun suddenly cooled, so that it was emitting a 5000K black body spectrum instead of its current 6000K, with more red light and less blue light, that change would be reflected in the light reflected from a white object, which would look more yellow or orange to our eyes.
There are a couple of caveats though:
- As @badjohn pointed out in a simultaneous answer, our brain processes visual information in odd ways. If the colour of sunlight changed, the brain might try and compensate for the overall shift and you might see everything more as you expect it, and less as it now is.
- We evolved to perceive sunlight as white. If we had evolved around a cooler star, we would probably perceive a different colour as white.
We see white objects as white under a very wide range of lighting conditions. Photography resources will be quite helpful. Look at a white piece of paper at dawn, at noon, and under a variety of artificial light sources. The spectrum of the light hitting your eye will vary a lot but, except in extreme cases, it will st6il look white. The answer is not in astronomy but the visual processing in our brains.
Some extra material.
As I just mentioned in a comment, digital cameras do something similar and call it automatic white balance. Search for that and you will loads of discussions in photography websites.
It fails in some extreme cases. E.g. sodium street lamps which are close to monochromatic and a combination of UV lamps and fluorescent substances.
You have confused solar spectral output with our neurological processing of collected photons. While it's true that a careful mix of red,blue, green photons may be perceived as "white" or "off-white," whiteness in general occurs when either (1) the cones, which discriminate on the basis of wavelength, saturate and all "output" signals are peak, or (2) the light levels are so low that only the rods, which do not discriminate by wavelength but have higher sensitivity than the cones, respond. For example, in a dim night locale, everything is black, grey or white.
It gets worse, as our brain reprocesses the incoming signals to make the colors we see "fit expectations." That's why we tend to observe everything in our backyard garden as having the same coloration all day, but if we take a photo at sunset, the image will show a skew towards the red (due to extreme loss of blue, green thru the atmosphere).