lipgloss-tree
A Rust library for rendering styled tree structures in terminal applications. This crate is part of the lipgloss-rs ecosystem, providing a 1:1 Rust port of the Go lipgloss/tree library from Charm.
Features
- Rich tree rendering with customizable branch characters (├──, └──, etc.)
- Custom enumerators supporting Roman numerals, bullet points, or any custom format
- Advanced styling with colors, padding, borders, and text formatting
- Multi-line content support with proper indentation
- Style inheritance from parent to child nodes
- Alignment control for mixed-width enumerators
Quick Start
use Tree;
let tree = new
.root
.child;
println!;
This produces:
My Project
├── src/
├── README.md
├── docs/
│ ├── guide.md
│ └── api.md
Advanced Usage
Custom Styling
use ;
use ;
use TreeStyle;
let custom_style = TreeStyle ;
let tree = new
.root
.child;
let renderer = new.style;
// Use renderer.render(&tree, true, "") for custom rendering
Custom Enumerators
use Tree;
let tree = new
.root
.child
.enumerator;
Architecture
The crate is organized into three main modules:
- [
children
] - Node and tree data structures - [
enumerator
] - Functions for generating branch characters and indentation - [
renderer
] - Core rendering engine with styling support