Color of spline in 3d view
My suggestion would be to:


Increase the bevel Depth value of the curve on the curve properties to give thickness to the curve
Make sure the Fill type for the curve is set to Full instead of half. So that the curve is a cylinder instead of a half cylinder. (Increase bevel Resolution for a smoother curve profile)
Assign separate materials with different colours to each curve. The curve now has a thickness so that materials can be displayed.


You should be able to incorporate the steps above into your script:

Something like the image below can be achieved:



Of course, a disadvantage may be that this only works for Object Mode and not Edit Mode.