Figured out that if I want more than 3 colors I have to do my own lerping. Here is the result in the material, you just chain the lerps together.
To get the same effect as your result, the depth test needs to be at the end of the lerp chain.
Any index after the depth test can be made to ignore depth. Pretty cool