use std::fmt;
use std::fmt::Display;
use cluColor;
macro_rules! build_type_colored {
( $( $color:tt | $color_byte:tt | $name:ident )+ ) => {
build_type_colored!( $( $color | $color_byte | $name, stringify!($name) )+ );
};
( $( $color:tt | $color_byte:tt | $name:ident, $doc_name:expr )+ ) => {
$(
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[doc = "Color Type `"]
#[doc = $doc_name]
#[doc = "`."]
pub enum $name {}
impl cluColor for $name {
#[doc = "Return \""]
#[doc = $color]
#[inline(always)]
fn raw_color<'a>() -> &'a str {
$color
}
#[doc = "Return b\""]
#[doc = $color]
#[doc = "\""]
#[inline(always)]
fn raw_color_b<'a>() -> &'a [u8] {
$color_byte
}
#[doc = "Return \""]
#[doc = $doc_name]
#[doc = "\""]
#[inline(always)]
fn name<'a>() -> &'a str {
$doc_name
}
}
impl Display for $name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", Self::name())
}
}
)+
};
}
build_type_colored! (
"30" | b"30" | Black
"31" | b"31" | Red
"32" | b"32" | Green
"33" | b"33" | Yellow
"34" | b"34" | Blue
"35" | b"35" | Magenta
"36" | b"36" | Cyan
"37" | b"37" | White
"90" | b"90" | BrightBlack
"91" | b"91" | BrightRed
"92" | b"92" | BrightGreen
"93" | b"93" | BrightYellow
"94" | b"94" | BrightBlue
"95" | b"95" | BrightMagenta
"96" | b"96" | BrightCyan
"97" | b"97" | BrightWhite
);