Add Debug to color structs and Clone to Rgb / Fg / Bg (#51)

This commit is contained in:
Esption 2016-10-03 00:15:12 -05:00 committed by ticki
parent 44c847924c
commit a0751f21b0
1 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ pub trait Color {
macro_rules! derive_color {
($doc:expr, $name:ident, $value:expr) => {
#[doc = $doc]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct $name;
impl Color for $name {
@ -62,7 +62,7 @@ derive_color!("High-intensity light cyan.", LightCyan, "14");
derive_color!("High-intensity light white.", LightWhite, "15");
/// An arbitrary ANSI color value.
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Debug)]
pub struct AnsiValue(pub u8);
impl AnsiValue {
@ -100,6 +100,7 @@ impl Color for AnsiValue {
}
/// A truecolor RGB.
#[derive(Debug, Clone)]
pub struct Rgb(pub u8, pub u8, pub u8);
impl Color for Rgb {
@ -115,6 +116,7 @@ impl Color for Rgb {
}
/// Reset colors to defaults.
#[derive(Debug)]
pub struct Reset;
impl Color for Reset {
@ -130,6 +132,7 @@ impl Color for Reset {
}
/// A foreground color.
#[derive(Debug, Clone)]
pub struct Fg<C: Color>(pub C);
impl<C: Color> fmt::Display for Fg<C> {
@ -139,6 +142,7 @@ impl<C: Color> fmt::Display for Fg<C> {
}
/// A background color.
#[derive(Debug, Clone)]
pub struct Bg<C: Color>(pub C);
impl<C: Color> fmt::Display for Bg<C> {