code: function getColourAt(gradient, p) {
    p = clamp(p, 0, 0.9999);  // FIXME
    let r = Math.floor(p * (gradient.length - 1));
    let q = p * (gradient.length - 1) - r;
    return Colour.mix(gradient[r + 1], gradient[r], q);
  }
docs: Gets the colour of a multi-step gradient at a given percentage p