blazer
A blazing-fast, dependency-minimal Rust library for styling, coloring, and enhancing command-line interfaces.
Basic Example:
use Stylize;
println!;
println!;
println!;
println!;
Table of Contents
- Overview
- Installation
- Features
- Color Support
- API Documentation
- Examples
- Terminal Compatibility
- Contributing
- License
Overview
blazer gives you a clean, ergonomic API for every common CLI visual need —
from simple colored output to animated spinners and formatted tables — with
zero mandatory runtime dependencies beyond libc (Unix only) and the
standard library.
| Concern | Solution |
|---|---|
| Colors & styles | Stylize trait (chainable) |
| Progress feedback | ProgressBar widget |
| Indeterminate feedback | Spinner (background thread) |
| Tabular data | Table with box-drawing |
| Symbol/icon shorthand | symbols module (✔ ✗ ➜ …) |
| Terminal introspection | terminal module (size, color check) |
Installation
Add blazer to your Cargo.toml:
[]
= "0.1"
Or use the command line:
Features
Text Styling
The Stylize trait
implements on &str and String, giving you chainable methods for
foreground colors, background colors, and text attributes.
use Stylize;
// 16 standard ANSI colors + 16 bright variants
println!;
println!;
// Text attributes (chain freely)
println!;
println!;
println!;
// Background colors
println!;
println!;
// Custom foreground / background
println!;
println!;
// 256-color palette (0-255)
println!;
Every styled string automatically resets at the end, so you never have to worry about leaking styles into subsequent output.
Progress Bars
ProgressBar
renders a customizable bar directly to the terminal, updating in place on each
draw call.
use ProgressBar;
use ;
Output:
Downloading [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% Download complete!
Builder options:
| Method | Description |
|---|---|
with_width(n) |
Set bar width in characters |
with_chars(filled, empty) |
Choose fill characters |
with_label("text") |
Display a label before the bar |
show_percentage(bool) |
Toggle the trailing percentage |
inc(delta) |
Increment progress |
finish() / finish_with_message(msg) |
Complete the bar |
Spinners
Spinner
animates on a background thread so your main thread stays free.
use Spinner;
use frames;
use ;
Built-in frame sets in blazer::symbols::frames:
| Constant | Animation | Example frames |
|---|---|---|
DOTS |
Classic braille dots | ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ … |
LINE |
Simple ASCII (portable) | `- \ |
BAR |
Growing / shrinking bar | ▁ ▃ ▄ ▅ ▆ ▇ █ |
ARROW |
Rotating arrow | ← ↖ ↑ ↗ → ↘ ↓ ↙ |
You can also supply your own &'static [&'static str].
Tables
Table renders
customizable, neatly aligned, box-drawn tables with flexible padding and border configurations.
use ;
Output:
+----------+---------+--------+
| Package | Version | Status |
+----------+---------+--------+
| serde | 1.0.188 | ✔ |
| tokio | 1.32.0 | ✔ |
| blazer | 0.1.0 | ✔ |
+----------+---------+--------+
Border Presets (Borders)
| Constant | Preview | Description |
|---|---|---|
Borders::SINGLE |
─ │ ┼ |
Standard single-line box drawing |
Borders::DOUBLE |
═ ║ ╬ |
Heavy double-line box drawing |
Borders::ASCII |
- | + |
Plain ASCII characters for maximum portability |
Borders::DASHED |
╌ ╎ ┼ |
Dashed Unicode border style |
Borders::DOTTED |
┄ ┊ ┼ |
Dotted Unicode border style |
Borders::EMPTY |
(None) | Completely borderless rendering |
You can also create fully custom borders or turn off borders with .borderless().
// Custom border
let custom_borders = empty.horizontal.vertical;
// Borderless helper
let table = new.borderless;
Padding Options (Padding)
Control left, right, and fill character properties on cells:
// Uniform spacing
let pad = uniform;
// Asymmetric padding
let pad = new;
// Custom fill character
let pad = uniform_with_fill;
CLI Symbols
Ready-to-use Unicode symbols for common CLI meaning, living in
blazer::symbols:
use *;
use Stylize;
println!;
println!;
println!;
println!;
println!;
| Constant | Glyph | Typical use |
|---|---|---|
CHECK |
✔ |
Success / passed |
CROSS |
✖ |
Failure / error |
WARNING |
⚠ |
Warning / caution |
INFO |
ℹ |
Informational note |
ARROW_RIGHT |
➜ |
Prompt / direction |
BULLET |
• |
List item |
STAR |
★ |
Favorite / rating |
HOURGLASS |
⌛ |
Waiting / processing |
HEART |
♥ |
Appreciation |
ELLIPSIS |
… |
Truncation |
Terminal Utilities
use terminal;
// Get terminal size (columns, rows)
if let Some = size
// Check color support (respects NO_COLOR and TERM=dumb)
if supports_color else
size() uses an ioctl call on Unix and GetConsoleScreenBufferInfo on
Windows, falling back to the COLUMNS/LINES environment variables.
Color Support
| Mode | Color variant |
ANSI codes | Notes |
|---|---|---|---|
| Standard (16) | Black … White |
30–37 / 40–47 | Most portable |
| Bright (16) | BrightBlack … BrightWhite |
90–97 / 100–107 | Widely supported |
| 256-color | Fixed(0..=255) |
38;5;n / 48;5;n |
Modern terminals |
| Truecolor (RGB) | Rgb(r, g, b) |
38;2;r;g;b / 48;2;r;g;b |
xterm-256, iTerm2, Kitty, Alacritty, Windows Terminal |
Recommendation: use terminal::supports_color() to detect basic support
and feature-detect COLORTERM=truecolor (or truecolor/24bit in TERM)
if you need to gate RGB output.
API Documentation
Full API documentation is available on docs.rs/blazer.
To generate and browse it locally:
Examples
Runnable examples live in the examples/ directory:
Terminal Compatibility
| Terminal / Environment | Status |
|---|---|
| Windows Terminal | ✅ Full support |
| iTerm2 (macOS) | ✅ Full support |
| Alacritty | ✅ Full support |
| Kitty | ✅ Full support |
| GNOME Terminal | ✅ Full support |
| xterm-256color | ✅ Full support |
| VS Code integrated terminal | ✅ Full support |
| cmd.exe / legacy conhost | ⚠️ Basic colors |
| dumb / NO_COLOR set | ⚠️ Plain text |
| CI (GitHub Actions, etc.) | ⚠️ Basic colors |
When in doubt, call terminal::supports_color() and degrade gracefully.
MSRV
The minimum supported Rust version is 1.70.
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-thing) - Run
cargo fmt,cargo clippy, andcargo test - Open a pull request
License
Licensed under the MIT License.