IR reflective sensor
This IR Sensor reflective sensor house both the IR LED and an IR phototransistorin a compact package. You can control the IR LED and turn it on to bounce IR off objects to determine their reflectivity. White & light colored stuff will bounce the light, so you can detect it. Black & dark colored stuff will absorb the IR light so that it isn’t detected.