@Override
  public final void visit(final @NotNull Node current, final int depth) {
    if (this.visited) {
      throw new IllegalStateException("Color changing tag instances cannot be re-used, return a new one for each resolve");
    }

    if (current instanceof ValueNode) {
      final String value = ((ValueNode) current).value();
      this.size += value.codePointCount(0, value.length());
    } else if (current instanceof TagNode) {
      final TagNode tag = (TagNode) current;
      if (tag.tag() instanceof Inserting) {
        // ComponentTransformation.apply() returns the value of the component placeholder
        LENGTH_CALCULATOR.flatten(((Inserting) tag.tag()).value(), s -> this.size += s.codePointCount(0, s.length()));
      }
    }
  }
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