static Tag create(final ArgumentQueue args, final Context ctx) {
    double phase = 0;
    final List<TextColor> textColors;
    if (args.hasNext()) {
      textColors = new ArrayList<>();
      while (args.hasNext()) {
        final Tag.Argument arg = args.pop();

        // Determine if this is a color first. Double#parseDouble is "slow" in cases where we hit a string.
        final String argValue = arg.value();
        final TextColor color = ColorTagResolver.resolveColorOrNull(argValue);

        if (color != null) {
          textColors.add(color);
        } else {
          // last argument? maybe this is the phase?
          if (!args.hasNext()) {
            final OptionalDouble possiblePhase = arg.asDouble();
            if (possiblePhase.isPresent()) {
              phase = possiblePhase.getAsDouble();
              if (phase < -1d || phase > 1d) {
                throw ctx.newException(String.format("Gradient phase is out of range (%s). Must be in the range [-1.0, 1.0] (inclusive).", phase), args);
              }
              break;
            }
          }

          // We hit an invalid color.
          throw ctx.newException(String.format("Unable to parse a color from '%s'. Please use named colors or hex (#RRGGBB) colors.", argValue), args);
        }
      }

      if (textColors.size() == 1) {
        throw ctx.newException("Invalid gradient, not enough colors. Gradients must have at least two colors.", args);
      }
    } else {
      textColors = Collections.emptyList();
    }

    return new GradientTag(phase, textColors, ctx);
  }
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