@Override
  protected TextColor color() {
    // from [0, this.colors.length - 1], select the position in the gradient
    // we will wrap around in order to preserve an even cycle as would be seen with non-zero phases
    final double position = ((this.index * this.multiplier) + this.phase);
    final int lowUnclamped = (int) Math.floor(position);

    final int high = (int) Math.ceil(position) % this.colors.length;
    final int low = lowUnclamped % this.colors.length;

    return TextColor.lerp((float) position - lowUnclamped, this.colors[low], this.colors[high]);
  }
A transformation that applies a colour gradient.

@since 4.10.0
text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/GradientTag.java