18 stable releases
Uses new Rust 2024
| new 2.14.0 | Mar 1, 2026 |
|---|---|
| 2.13.0 | Feb 9, 2026 |
| 2.12.4 | Jan 18, 2026 |
| 2.4.7 | Dec 30, 2025 |
#625 in Text processing
140KB
2K
SLoC
arborium-cli
A terminal-friendly syntax highlighter powered by Tree-sitter.
Features
- ANSI terminal output - Beautiful syntax highlighting in your terminal
- HTML output - Generate highlighted HTML for web pages
- Auto-detection - Automatically detects language from filenames or shebangs
- Multiple themes - Choose from 12 built-in themes
- Flexible input - Highlight files, stdin, or literal code strings
Installation
cargo install arborium-cli
Usage
# Highlight a file (auto-detects language from extension)
arborium file.rs
# Highlight from stdin
cat file.py | arborium -
# Highlight with explicit language
arborium --lang javascript "const x = 42;"
# Generate HTML output
arborium --html index.js
# Use a specific theme
arborium --theme dracula script.sh
Options
-l, --lang <LANGUAGE>- Specify the language explicitly (e.g., rust, python, javascript)--html- Output HTML instead of ANSI escape sequences--theme <THEME>- Choose a color theme for ANSI output (see below)<input>- Input source: filename,-for stdin, or literal code string
Available Themes
Catppuccin variants:
mocha/catppuccin-mocha(default)latte/catppuccin-lattemacchiato/catppuccin-macchiatofrappe/catppuccin-frappe
Other themes:
draculatokyo-nightnordone-darkgithub-darkgithub-lightgruvbox-darkgruvbox-light
Examples
# Compare different themes
arborium --theme nord mycode.rs
arborium --theme dracula mycode.rs
# Highlight a script with shebang detection
arborium script.py # Detects Python from .py extension
echo '#!/usr/bin/env python3\nprint("hello")' | arborium - # Detects from shebang
# Generate HTML for a blog post
arborium --html snippet.rs > highlighted.html
# Pipe code through arborium
git diff | arborium --lang diff
Language Auto-Detection
Arborium attempts to detect the language in this order:
- Explicit
--langflag (highest priority) - File extension - If input is a file path
- Shebang line - For stdin or literal strings (e.g.,
#!/usr/bin/env python3)
Supported languages include Rust, Python, JavaScript, TypeScript, C, C++, Go, Java, and many more.
License
See the main arborium repository for license information.
Dependencies
~26–155MB
~4M SLoC