color_please
A simple library for coloring terminal and terminal text graphics control.
It uses ANSI control sequences for setting colors and effects, tested only on MacOS.
Some of the features in effect controls may not be supported in some systems or some terminal emulators.
Usage
Coloring Foreground and Background
use color_please::*;
fn main(){
set_fg(Color::Red);
println!("This text is red.");
set_bg(Color::Yellow);
println!("And now the background is yellow.");
set_fg(Color::BrightGreen);
println!("Why don't use bright green and look like a hacker in a film?");
set_bg(Color::BrightCyan);
println!("Walls of my terminal is my favourite color!");
set_fg(Color::Color256(123));
println!("This text is color 123 of 256 colors.");
set_bg(Color::ColorRGB(0, 200, 256));
println!("The background is RGB(0,200,256).");
reset_fg();
reset_bg();
}
Graphics Control
use color_please::*;
fn main(){
bold();
faint()
italic();
underline();
blink();
blink_off();
fast_blink();
blink_off();
reverse();
reverse_off();
invisible();
println!("You can't see this.");
invisible_off();
println!("But you can see this.");
strike();
println!("Add color_please into the dependencies.");
strike_off();
bold_and_faint_off();
underline_off();
italic_off();
reset_all();
}
LICENSE
This project is distributed under MIT license.