tinycolor 1.0.0

A tiny but mighty Rust utility crate for printing colored strings in the terminal
Documentation

tinycolor

License: MIT Lines of Code: 881

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:

[dependencies]

tinycolor = "1"

or run:

cargo add tinycolor

And add this in your lib.rs or main.rs:

use tinycolor::Colorize;

fn main() {
    println!("{}{} {}{}",
        "Hello".green().bold(),
        ",".on_cyan().italic(),
        "world".rgb(207, 177, 150).dim(),
        "!".on_red().blink()
    );
}

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 colored or termcolor
  • Need to support Windows 7? Test with tinycolor first (ANSI support varies)

But if you just want to print pretty colors with minimal overhead, tinycolor is for you!