I don't think it's the perfect answer - but I post it as one, because the question is not Splunk related as well 😉
Have a look at the posts I found using a simple google search https://www.google.com/webhp?hl=en#hl=en&q=d3+sankey+change+color+based+on+value , because you must do this in either the
sankey.js or using
css but not in Splunk itself:
Hope this helps ...