Multi monitor XP, different color depths lead to greyscale variation

We have written a display driver for an 8 bit greyscale device.
In a multimon system for XP, our display is used along with a display
adapter that has 24 bit color. When an icon is dragged over the greyscale
monitor, the background color(greyscale) changes. This new color is always
a number of the form (n%8) = 4, nearest to the original color/greyscale.

How can we handle the translation of olors from 24 bit depth to 8 bit in
the display driver?

Please reply on