Merge pull request #34 from jackpot51/patch-2
Allow colors to be reset to terminal defaults
This commit is contained in:
commit
c43f54accd
15
src/color.rs
15
src/color.rs
|
@ -100,6 +100,21 @@ impl Color for Rgb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reset colors to defaults.
|
||||||
|
pub struct Reset;
|
||||||
|
|
||||||
|
impl Color for Reset {
|
||||||
|
#[inline]
|
||||||
|
fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, csi!("39m"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, csi!("49m"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A foreground color.
|
/// A foreground color.
|
||||||
pub struct Fg<C: Color>(pub C);
|
pub struct Fg<C: Color>(pub C);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue