Can I color a curve in Cycles by the direction it's running?
This is totally possible with the Tangent node (Input > Tangent):



Change the type from Radial to UV Map and also enable Use UV for mapping in Curve's data tab:





The problem is we get black instead of Z-axis direction. That's easily fixable - add both green and red channels together and invert them into a blue channel. To also not care about the direction of axis we make the tangent vector values absolute: