You may try the following approach:

function generatePallete(n) {
  const scale = t => d3.interpolateSinebow(t * 0.85);
  return d3.range(n).map(i => scale(i / n))

You can replace d3.interpolateSinebow with any other sequential scale. I multiplied t by 0.85 because d3.interpolateSinebow is cyclical and start end end colors are the same.

Here is an example of generated palletes:

Related Query