#[derive(Clone, Debug)]
pub enum Colour {
None,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
}
impl Colour {
pub fn ansi_code(&self) -> &str {
match self {
Colour::None => "",
Colour::Red => "\x1b[31m",
Colour::Green => "\x1b[32m",
Colour::Yellow => "\x1b[33m",
Colour::Blue => "\x1b[34m",
Colour::Magenta => "\x1b[35m",
Colour::Cyan => "\x1b[36m",
}
}
pub fn reset() -> &'static str {
"\x1b[0m"
}
}
impl Default for Colour {
fn default() -> Self {
Colour::None
}
}
pub enum Style {
ASCII,
Block,
Balloon,
Pacman,
Custom(String),
}
impl Default for Style {
fn default() -> Self {
Style::Block
}
}
impl std::fmt::Display for Style {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
Style::ASCII => "0123456789#",
Style::Block => " ▏▎▍▌▋▊▉█",
Style::Balloon => ".oO@*",
Style::Pacman => "C-",
Style::Custom(n) => &n[..],
}
)
}
}