@Override
  public final Component apply(final @NotNull Component current, final int depth) {
    if (this.emitVirtuals && depth == 0) {
      // capture state into a virtual component, no other logic is needed in normal MM handling
      return Component.virtual(Void.class, new TagInfoHolder(this.preserveData(), current), current.style());
    }

    if ((this.disableApplyingColorDepth != -1 && depth > this.disableApplyingColorDepth) || current.style().color() != null) {
      if (this.disableApplyingColorDepth == -1 || depth < this.disableApplyingColorDepth) {
        this.disableApplyingColorDepth = depth;
      }
      // This component has its own color applied, which overrides ours
      // We still want to keep track of where we are though if this is text
      if (current instanceof TextComponent) {
        this.skipColorForLengthOf(((TextComponent) current).content());
      }
      return current.children(Collections.emptyList());
    }

    this.disableApplyingColorDepth = -1;
    if (current instanceof VirtualComponent) {
      // this component has its own information, so we can't rainbowify direct content -- we can process children tho
      // basically treat as if it's a non-text component
      this.skipColorForLengthOf(((VirtualComponent) current).content());

      return current.children(Collections.emptyList());
    } else if (current instanceof TextComponent && ((TextComponent) current).content().length() > 0) {
      final TextComponent textComponent = (TextComponent) current;
      final String content = textComponent.content();

      final TextComponent.Builder parent = Component.text();

      // apply
      final int[] holder = new int[1];
      for (final PrimitiveIterator.OfInt it = content.codePoints().iterator(); it.hasNext();) {
        holder[0] = it.nextInt();
        final Component comp = Component.text(new String(holder, 0, 1), current.style().color(this.color()));
        this.advanceColor();
        parent.append(comp);
      }

      return parent.build();
    } else if (!(current instanceof TextComponent)) {
      final Component ret = current.children(Collections.emptyList()).colorIfAbsent(this.color());
      this.advanceColor();
      return ret;
    }

    return Component.empty().mergeStyle(current);
  }
A transformation that applies a colour change.

<p>The lifecycle is:</p>

<ol>
<li>init()</li>
<li>(color()? advanceColor())*</li>
</ol>

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