Add `Color` implementation for `&Color`

Fix #53
This commit is contained in:
ticki 2016-12-18 19:28:25 +01:00
parent e67128f795
commit 7047acbabf
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "termion" name = "termion"
version = "1.1.3" version = "1.1.4"
authors = ["ticki <Ticki@users.noreply.github.com>", "gycos <alexandre.bury@gmail.com>"] authors = ["ticki <Ticki@users.noreply.github.com>", "gycos <alexandre.bury@gmail.com>"]
description = "A bindless library for manipulating terminals." description = "A bindless library for manipulating terminals."
repository = "https://github.com/ticki/termion" repository = "https://github.com/ticki/termion"

View File

@ -61,6 +61,18 @@ derive_color!("High-intensity light magenta.", LightMagenta, "13");
derive_color!("High-intensity light cyan.", LightCyan, "14"); derive_color!("High-intensity light cyan.", LightCyan, "14");
derive_color!("High-intensity light white.", LightWhite, "15"); derive_color!("High-intensity light white.", LightWhite, "15");
impl<'a> Color for &'a Color {
#[inline]
fn write_fg(&self, f: &mut fmt::Formatter) -> fmt::Result {
(*self).write_fg(f)
}
#[inline]
fn write_bg(&self, f: &mut fmt::Formatter) -> fmt::Result {
(*self).write_bg(f)
}
}
/// An arbitrary ANSI color value. /// An arbitrary ANSI color value.
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct AnsiValue(pub u8); pub struct AnsiValue(pub u8);