colorify 0.2.2

Convenience macros for printing to the terminal in color on non-Windows platforms.

Crate colorify [] [src]

Format text printed to the terminal using ANSI colors.

Usage

Add the following to your Cargo.toml:

[dependencies]
colorify = "0.2"

Example

#[macro_use] extern crate colorify;
use std::io::{self, Write};
 
fn main() {
    // List colors:
    printc!(help);
 
    // Use one of three ways:
    printc!(yellow: "Number of banana peels on head: {}", 7);
    printlnc!(red: "Number of zombies killed: {}", 50);
    writeln!(io::stdout(), colorify!(orange: "Number of baggies filled \
        while walking dogs: {}"), 2).unwrap();
}

Macros

colorify!

Adds color to a formatting literal.

help!

Returns a help string which lists all of the colors.

printc!

print! with all the glorious colors of the the ANSI rainbow.

printlnc!

println! with color.