You can easily create a color scale that map a particular domain of values. In this example, the number from 1 to 20 are mapped to the colors from white to blue.
You can even define a pivot in your scale; the color reaches its maximumal value at a given point of the domain, and then go back.
Click on the button to change the pivot
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js