You could calculate the gradient for each segment.
Material:
Blueprint:
Result:
Runtime Spline Editor