How to wire an analog IR sensor for digital input?
Near the bottom of:

https://learn.sparkfun.com/tutorials/qrd1114-optical-detector-hookup-guide

shows a graph of the voltage for a white surface and a black surface. If I understand your question correctly, I think you can get your desired results by controlling the distance between the sensor and the surface. For example, at 0.5mm white reads about 0.1V while black reads about 3.2V

A 330Ω current-limiting resistor and a 10kΩ pull-up resistor were used in their circuit.

Hope this helps.