pub mod effects {
pub enum Color {
Black,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
White,
RGB(u8, u8, u8),
}
pub enum Special {
Bold,
Underline,
Stroke,
Italic,
Reset,
}
}
pub mod print {
use crate::effects::Color;
use crate::effects::Special;
pub fn fg(col: Color) -> String {
match col {
Color::Black => String::from("\x1b[30m"),
Color::Red => String::from("\x1b[31m"),
Color::Green => String::from("\x1b[32m"),
Color::Yellow => String::from("\x1b[33m"),
Color::Blue => String::from("\x1b[34m"),
Color::Magenta => String::from("\x1b[35m"),
Color::Cyan => String::from("\x1b[36m"),
Color::White => String::from("\x1b[37m"),
Color::RGB(r, g, b) => format!("\x1b[38;2;{};{};{}m", r, g, b),
}
}
pub fn bg(col: Color) -> String {
match col {
Color::Black => String::from("\x1b[40m"),
Color::Red => String::from("\x1b[41m"),
Color::Green => String::from("\x1b[42m"),
Color::Yellow => String::from("\x1b[43m"),
Color::Blue => String::from("\x1b[44m"),
Color::Magenta => String::from("\x1b[45m"),
Color::Cyan => String::from("\x1b[46m"),
Color::White => String::from("\x1b[47m"),
Color::RGB(r, g, b) => format!("\x1b[48;2;{};{};{}m", r, g, b),
}
}
pub fn sp(special: Special) -> String {
match special {
Special::Bold => String::from("\x1b[1m"),
Special::Underline => String::from("\x1b[4m"),
Special::Stroke => String::from("\x1b[9m"),
Special::Italic => String::from("\x1b[3m"),
Special::Reset => String::from("\x1b[0m"),
}
}
}