Skip to content

Cyclical schemes

To create a cyclical continuous color scale using the Rainbow color scheme:

js
const color = d3.scaleSequential(d3.interpolateRainbow);

interpolateRainbow(t)

Source · Given a number t in the range [0,1], returns the corresponding color from d3.interpolateWarm scale from [0.0, 0.5] followed by the d3.interpolateCool scale from [0.5, 1.0], thus implementing the cyclical less-angry rainbow color scheme.

interpolateSinebow(t)

Source · Given a number t in the range [0,1], returns the corresponding color from the “sinebow” color scheme by Jim Bumgardner and Charlie Loyd.