Crate skittles [−] [src]
Add colors and formatting to ANSI terminal output with easy-to-use macros built on
top of ansi_term
.
Installation
First, add skittles
to the dependencies section of your Cargo.toml
:
[dependencies]
skittles = "0.1"
Next, add add this to the entrypoint of your crate (lib.rs
or main.rs
).
#[macro_use] extern crate skittles;
Usage
Each macro provided by skittles
can accept a string literal or a format string with
arguments as input.
println!( "{} - {} {} {}.", underline!("Skittles"), red!("Taste"), green!("the"), blue!("rainbow") );
You can also compose skittles
macros together to get the exact color and formatting
you want while avoiding itermediate allocations entirely.
println!( "{} - {} {} {}.", blink!(yellow!("Skittles")), underline!(red!("Taste")), underline!(italic!(green!("the"))), underline!(bold!(blue!("rainbow"))) );
Macros
black |
Colors the output string black. |
blink |
Makes the output string blink. |
blue |
Colors the output string blue. |
bold |
Use a bold font style. |
cyan |
Colors the output string cyan. |
dimmed |
Dims the color of the output string. |
green |
Colors the output string green. |
hidden |
Hides each character. |
italic |
Use an italic font style. |
purple |
Colors the output string purple. |
red |
Colors the output string red. |
reverse |
Reverses the foreground and background color. |
strikethrough |
Inserts a line through each character. |
underline |
Inserts a line underneath each character. |
white |
Colors the output string white. |
yellow |
Colors the output string yellow. |