def gradient(colour1, colour2, interpolation_mode, num_leds):
    """Creates a gradient between two colours.

    :param colour1: the colours used at the start of the gradient.
    :param colour2: the colour used at the end of the gradient.
    :param interpolation_mode: the InterpolationMode used to interpolate the
    colours.
    :param num_leds: the number of LEDs this gradient is expected to be
    displayed over.
    :return: a list of colours ordered in a gradient of colour1 to colour2.
    """
    return [
        interpolation_mode.interpolate(colour1, colour2, float(i) / num_leds)
        for i in range(0, num_leds)]