Skip to main content

Crate blazer

Crate blazer 

Source
Expand description

§Blazer

blazer is a lightweight, dependency-minimal library for building beautiful command-line interfaces in Rust. It provides:

§Quick start

use blazer::Stylize;

println!("{}", "Success!".green().bold());
println!("{}", "Warning".yellow().italic());
println!("{}", "Error".white().on_red().bold());
println!("{}", "Custom".rgb(255, 140, 0));

§Progress bars

use blazer::progress::ProgressBar;

let mut bar = ProgressBar::new(50).with_label("Downloading");
for i in 0..=50 {
    bar.set_position(i);
    bar.draw();
    std::thread::sleep(std::time::Duration::from_millis(20));
}
bar.finish_with_message("Done!");

§Spinners

use blazer::spinner::Spinner;

let mut spinner = Spinner::new("Working...");
spinner.start();
std::thread::sleep(std::time::Duration::from_secs(2));
spinner.stop("Finished!");

§Tables

use blazer::table::Table;

let mut table = Table::new(vec!["Name", "Status"]);
table.add_row(vec!["build", "ok"]);
table.add_row(vec!["test", "failed"]);
table.print();

§Module overview

ModulePurpose
colorColor enums and ANSI code generation
[style]The Stylize trait and StyledString
progressProgress bar widget
spinnerAnimated spinner widget
tableSimple table renderer
symbolsCommon CLI Unicode symbols
terminalTerminal size & color support detection

Re-exports§

pub use color::Color;
pub use style::strip_ansi;
pub use style::StyledString;
pub use style::Stylize;

Modules§

color
Color definitions and utilities for terminal output.
progress
A simple, customizable terminal progress bar.
spinner
A simple animated terminal spinner for indicating ongoing work.
style
Text styling functionality including colors, bold, italic, underline, and more.
symbols
Common Unicode symbols and icons useful for CLI output, such as checkmarks, crosses, arrows, and spinner frame sets.
table
A minimal table renderer for displaying tabular data in the terminal.
terminal
Terminal utilities: querying the size of the terminal window and detecting whether output likely supports color.

Macros§

paint
A macro for styling strings using inline markup tags and printing them to standard output. Paint prints the styled string and then resets the style without adding a new line.
paintln
A macro for styling strings using a shorthand idiomatic syntax and printing them to standard output. Paintln prints the styled string and then resets the style, adding a new line.
style
A macro for styling strings using inline markup tags.