Crate afetch_colored

source ·
Expand description

Coloring terminal so simple, you already know how to do it !

use colored::Colorize;

"this is blue".blue();
"this is red".red();
"this is red on blue".red().on_blue();
"this is also red on blue".on_blue().red();
"you can use truecolor values too!".truecolor(0, 255, 136);
"background truecolor also works :)".on_truecolor(135, 28, 167);
"you can also make bold comments".bold();
println!("{} {} {}", "or use".cyan(), "any".italic().yellow(), "string type".cyan());
"or change advice. This is red".yellow().blue().red();
"or clear things up. This is default color and style".red().bold().clear();
"purple and magenta are the same".purple().magenta();
"bright colors are also allowed".bright_blue().on_bright_white();
"you can specify color by string".color("blue").on_color("red");
"and so are normal and clear".normal().clear();
String::from("this also works!").green().bold();
format!("{:30}", "format works as expected. This will be padded".blue());
format!("{:.3}", "and this will be green but truncated to 3 chars".green());

See the Colorize trait for all the methods.

Note: The methods of Colorize, when used on str’s, return ColoredString’s. See ColoredString to learn more about them and what you can do with them beyond continue to use Colorize to further modify them.

Re-exports§

Modules§

Structs§

  • A string that may have color and/or style applied to it.
  • A combinatorial style such as bold, italics, dimmed, etc.

Enums§

  • The 8 standard colors.
  • Enum containing all of the available style settings that can be applied to a Styles and by extension, a colrized type.

Traits§

  • The trait that enables something to be given color.