Use the right key and the lock opens. Fire the right photons at the right kind of matter and interesting things happen. Some colours trigger an effect: others do not. Photosynthesis, the colour of flowers, walls and bicycles are all determined by what between photons and the chemicals in the materials.
Many locks work with keys even if the fit is a bit loose. That’s now it is with matter and photons: sometimes the fit is exact, sometimes not.