Recently I was eating a yellow rice for lunch in a restaurant with only yellow lights. But the rice looked white! I was intrigued by this because I always thought it should look yellow since the yellow pigment reflects only yellow light, but the rice looked really, really white. Why is that? I thought it could be something about the rice, but any yellow object was looking white. The room was full of yellow light bulbs (not normal yellowish bulbs, but very tinted yellow lights) and there was no other color of light to interfere. Maybe there's something to do with human perception?
Your brain adjusts your perception of color to compensate for lighting that is strongly tinted. This was the reason for the violent conflict some time back about a certain dress. Depending on whether people perceived the dress was being lit by yellow-tinted or blue-tinted light, they saw either a black and blue dress or a white and gold dress. Here's an animated version to show that color happens in the brain, not physics.
Here's another picture to show that your brain interprets colors contextually. The squares marked A and B are exactly the same shade of grey. But, because your brain interprets square B as being in a shadow, it "knows" that the "real" color of the square is lighter. So, you perceive a lighter shade than what is actually there.
Below is an edited version of the checkerboard showing a single color linking the squares A and B (the squares A and B have not been recolored). What I find funny is that half the time I see the squares and line as single color, and half the time I see a gradient from the "dark" square to the "light" square. In the animated picture above, I still see the moving swatch fading from one color to another as it moves.
So, because of the strong yellow lighting in the restaurant, your brain thought the yellow of the rice was due to the lighting and "corrected" your perception. I keep saying the brain does this because all of this visual post-processing happens subconsciously.
Pictures taken from the wikipedia article: https://en.wikipedia.org/wiki/Checker_shadow_illusion
To summarize, the physics of light ends at your retina. Particles of light (photons), each with a a certain energy, hit the cells of your retina, setting off electrical signals that travel to your brain. Your brain then processes these electrical signals to create a coherent image. These processes include factors from memory (what things "should" look like), local contrasts (in color and brightness), cues from the environment (including available light sources), and many others. The result of all this mental post-processing can result in identical photons creating different colors in the mind, as evidenced by the picture above.
Now, who do you trust? Me or your lying eyes?
As already explained in other answers, it is about perception, not physics.
If you take a piece of white paper outdoors on a clear sunny day and look at it, it looks white. If you photograph it with an old-fashioned film camera, the paper will appear white in the finished print. If you repeat the same exercise indoors let's say at night with only incandescent bulbs for illumination, the paper will still look white to your eyes, but in a photograph processed exactly the same way as your outdoor picture, the paper will take on a reddish tint.
The reason is as already explained. Incandescent lights emit a different balance of color than is present in daylight - there is more red. Your brain compensates for the difference because you know the paper is white - it will always be white, so you perceive it as white regardless of the ambient lighting. The photographic film doesn't have this privilege - it captures the light that actually exists.
In your case, your brain notices that everything has a yellow cast due to the yellow lighting, so interprets anything yellow as white. If you had both yellow rice and white rice under the yellow light, they would both look white because the yellow rice is absorbing the non-yellow light (of which there is none) and reflecting all the yellow light; the white rice is reflecting all the light falling on it, of which there is only yellow. So, both kinds of rice are reflecting only yellow light, which your brain deems to be white.
For what it's worth, to do this experiment with a digital camera, you need to be aware that they have a feature known as white balance. In its automatic mode, the camera's white balance does what your brain does - make its best guess as to what is supposed to be white in the picture and make sure it is rendered as white. To use a digital camera to reveal the effect of different lighting conditions, you need to turn off the camera's automatic white balance; if it has an "outdoor" setting, use that for both your outdoor (sunlit) and indoor (artificially lit) pictures.
It is perception. In yellow lighting white and yellow rice will look quite similar, so your brain tends to believe that you see white rice.
White objects reflect light of all colours, while yellow objects reflect blue light much less. In yellow lighting, which lacks the blue component, the difference between white and yellow vanishes.
I copy all the answers, it is caused by the perception. The brain does wonderful things during the processing the signal from your eyes to your mind.
The brain automatically adjusts the image to collect as much as possible and uses your expirience to adjuts the scene.
In your example you subconsciously expect the rice to be white because rice is usually white, right? All the objecs are slightly yellow-tinted so your brain compensates the overall colour balance and unyellow all yellow objects.
Application of such filters take some time; next time when you enter the restaurant you should see everything yellow-tinted and over the time the tint should fade away. You can try to wear amber goggles. When skiing I can see the snow yellow and after some time I can see the snow white. If I have them on long enough I cannot see blue colour at all when I take them off. Everything is green. I know I have blue skis but I see them green for a while.
The brain does more advanced tricks also. It can locally adjust the sensitivity of the retina. Try to stare long enough on following pictures 1, 2 and then look at plain white paper/screen/wall. You will see the negative.