code: function(depth) {
  
                  // depth -1 will be the background,
                  var index = depth < 0 ? 0 : depth;
                  // to make sure it is not exceed the color range.
                  if(index > self.options.colorRange.length - 1) {
                      index = self.options.colorRange.length - 1;
                  }
  
                  return self.options.colorRange[index];
              }
docs: TODO: how to visually show the color range? map domain -1 to 5 to color range of hsl(152,80%,80%) to hsl(228,30%,40%) var color = d3.scale.linear() .domain([-1, 2]) .range(self.options.colorRange) .interpolate(d3.interpolateHcl); this is another solution to set the color range for the background color.