DVI being a digital interface does not mean that pixels on the display have to be either fully on or fully off because of the digital “zeroes and ones”.
Using DVI, a number of bits are transferred for each pixel to represent what we would like the display to show. The actual number of bits per pixels varies depending on your configuration – but it can be up to 48 bits in a dual-link DVI setup, but is typically 24 bits per pixels in many setups. It can also be fewer than that.
In a typical 24 bits per pixel setup, you would find that the intensity of the red, green and blue colors are described for each as a number from 0-254. I.e. 8 bit per color, 24 bits per pixel for a RGB setup.
Note that the above is a simplified explanation of how DVI works on a conceptual level. The actual signal transferred over the wire actually uses 10 bits symbols to transfer 8 bit worth of payload data.