Expand description
Component Based Terminal Colorization
Usage Steps
- Predefine your Styles
- Create a ColoredString with the predefined style
- print the ColoredString just like using a normal String
Example
use inksac::check_color_available;
use inksac::types::*;
match check_color_available() {
Ok(_) => println!("Terminal supports ANSI colors"),
Err(_) => println!("Terminal does not support ANSI colors"),
}
// Step 1
const TITLESTYLE: Style = Style{
forground: Some(Color::Green),
background: Some(Color::Red),
bold: false,
dim: false,
italic: false,
underline: false
};
// Step 2
let title_text: ColoredString = ColoredString::new(
"Hello World",
TITLESTYLE
);
// Step 3
println!("{}", title_text);Modules
Functions
- Ckeck if the terminal supports ANSI colors