pub use std::string::ToString;
pub fn red<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[31m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}
pub fn green<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[32m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}
pub fn yellow<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[33m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}
pub fn blue<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[34m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}
pub fn magenta<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[35m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}
pub fn cyan<T: ToString>(text: T, bold: bool, underline: bool) -> String {
let mut result = String::from("\x1b[36m".to_owned() + &text.to_string() + "\x1b[0m");
if bold {
result = "\x1b[1m".to_owned() + &result;
}
if underline {
result = "\x1b[4m".to_owned() + &result;
}
return result;
}