tinycolor
A tiny but mighty Rust utility crate for printing colored strings in the terminal
Why tinycolor?
tinycolor is designed for Rust terminal/CLI programs where binary size and compile times matter
It does one thing and does it well: adding ANSI colors to your terminal output
Comparisons
| Crate | Source Lines of Code |
|---|---|
crossterm |
7500+ |
colored |
2000+ |
termcolor |
1800+ |
tinycolor |
Only 881! ✨ |
tinycolor fits in just under 900 lines and the entire crate can stay in one single lib.rs!
See tinycolor in action
Add this in your Cargo.toml:
[]
= "1"
or run:
And add this in your lib.rs or main.rs:
use Colorize;
Features
- Zero dependencies by default - keeps your build lean
- Simple API - just import and use
- Serde support - enable with
features = ["serde"] - Extended colors - enable with
features = ["color-ext"]for additional effects
Why you might want alternatives
- Need cursor movement or terminal events? Use
crossterm - Need logging integration? Use
coloredortermcolor - Need to support Windows 7? Test with
tinycolorfirst (ANSI support varies)
But if you just want to print pretty colors with minimal overhead, tinycolor is for you!