The red paint is red because when the ambient light strikes it, the composition of the material is such that it absorbs all other colors in the visible spectrum except for red. The red light, not being absorbed, reflects off the paint and is what we see. This same mechanism describes the color of material objects – note that light is not a material object – and so applies to the yellow paint as well.