I'm trying to work out a node group that will take the distance value from the camera to color objects from that point forwards / backwards and i've been triying to find an output that will give me this value so i can use it.
You can use the Vector Transform node to convert from Object or World coordinates (depending on whether you're using 'Object'coordinates from the Texture Coordinates node or the Position from the Geometry node) and then Separate XYZ to get the distance from the Z coordinate. With some simple maths you can then shade based on distance based on the depth of field.
In the above material, changing the value of the Subtract node will adjust the distance to the centre of the 'range' affected by the Color Ramp (larger values are more distant). Changing the value of the Divide node will affect the span of the 'range' (larger values spread the colors over a deeper range).
Note that you must have the Vector Transform set to 'Point' for this to work with Object coordinates.
EDIT : As pointed out by @sambler, the first 3 nodes can actually be replaced with a Camera Data node.
The View Z Depth socket will produce the same result as that shown above (the distance from the plane of the camera) whereas the View Distance will be a true distance from the point location of the camera.
Note, however, that the Vector Transform method is still useful if you require additional effects - such as applying a transform to the Camera or Object coordinates using a Mapping Node (to, say, rotate or shift along an axis) or similar.