coloredDepth static method
Creates a tree with colored depth levels.
Implementation
static Tree coloredDepth(String rootLabel, {List<Color>? depthColors}) {
final colors =
depthColors ??
[Colors.info, Colors.cyan, Colors.green, Colors.yellow, Colors.magenta];
return Tree()
..root(rootLabel)
..enumerator(TreeEnumerator.rounded)
..itemStyleFunc((children, index) {
final node = children[index];
final isDir = node.childrenNodes.isNotEmpty;
final colorIndex = index % colors.length;
final style = Style().foreground(colors[colorIndex]);
if (isDir) return style.bold();
return style;
});
}