function interpolate(color1, color2, factor) {
    if (factor === void 0) {
      factor = 0.5;
    }
    var result = color1.slice();
    for (var i = 0; i < 3; i++) {
      result[i] = Math.round(result[i] + factor * (color2[i] - color1[i]));
    }
    return result;
  }
Interpolate (blend) two colors with a given factor