Crate ansi_gfx

Source
Expand description

Simple ANSI graphics code formatter.

§Examples

Set attributes:

println!(
	"{}Hello {}world!{}",
	ansi_gfx::BOLD, ansi_gfx::UNDERLINE, ansi_gfx::RESET);
Hello world!

Change text foreground and background color:

println!(
	concat!(
		"Foreground {}Red {}Green {}and {}Blue{}!\n",
		"Background {}Red {}Green {}and {}Blue{}!"),
	ansi_gfx::RED, ansi_gfx::GREEN, ansi_gfx::RESET, ansi_gfx::BLUE, ansi_gfx::RESET,
	ansi_gfx::RED_BG, ansi_gfx::GREEN_BG, ansi_gfx::RESET, ansi_gfx::BLUE_BG, ansi_gfx::RESET);
Foreground Red Green and Blue!
Foreground Red Green and Blue!

Combine attributes, colors and extended colors using the mode! macro:

println!(
	"{}Here comes the sun!{}",
	ansi_gfx::mode!(UNDERLINE; FG RGB 243, 159, 24; BG PAL 28),
	ansi_gfx::RESET);
Hello world!

Re-exports§

pub use self::codes::*;

Modules§

codes
Color codes and attributes.

Macros§

mode
ANSI graphics mode builder for complex codes.

Structs§

Code
Single ANSI graphics code.
Print
Format graphics codes as an ANSI escape sequence.