color-code by Z-depth?

Would it be possible to setup a preset to have the active viewport (not the final render) display red in front, gradually changing to blue for further back along the Z axis? This is for using Chromadepth stereo 3D glasses.
Thanks.