Wrapped path coloring in a function.