@Override
  protected @NotNull Consumer<TokenEmitter> preserveData() {
    final TextColor[] colors;
    final double phase;

    if (this.negativePhase) {
      colors = Arrays.copyOf(this.colors, this.colors.length);
      Collections.reverse(Arrays.asList(colors));
      phase = this.phase - 1;
    } else {
      colors = this.colors;
      phase = this.phase;
    }

    return emit -> {
      emit.tag(GRADIENT);
      if (colors.length != 2 || !colors[0].equals(DEFAULT_WHITE) || !colors[1].equals(DEFAULT_BLACK)) { // non-default params
        for (final TextColor color : colors) {
          if (color instanceof NamedTextColor) {
            emit.argument(NamedTextColor.NAMES.keyOrThrow((NamedTextColor) color));
          } else {
            emit.argument(color.asHexString());
          }
        }
      }

      if (phase != 0) {
        emit.argument(Double.toString(phase));
      }
    };
  }
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