Crate ansi_style

Source
Expand description

§ansi-style

§Usage

use ansi_style::{Color, Style};

// You can either color the text directly with the Color enumeration
println!(
    "{}Cyan colored \"Hello World!\"{}",
    Color::Cyan.open(),
    Color::Cyan.close()
);

// or you can use the builder function from within the Style stuct
// to create a style that can be used for more than one instance of
// a string and you wouldn't need to have an open and close function
// prepended and appended to every text you type like the above example

let style = Style::builder().red().strikethrough().build();

println!(
    "{}",
    style.stylize("Hello World in red with strikethrough")
)

Structs§

Style
A collection of properties that can be used to format a string using ANSI escape codes.
StyleBuilder
A helper struct for creating the Style object

Enums§

BGColor
The BGColor enumeration can be used to directly add color in ANSI compatible environments without the use of the Style struct.
Color
The Color enumeration can be used to directly add color in ANSI compatible environments without the use of the Style struct.