From 7047acbabf500410cf132c457bf940927df3b626 Mon Sep 17 00:00:00 2001 From: ticki Date: Sun, 18 Dec 2016 19:28:25 +0100 Subject: [PATCH] Add `Color` implementation for `&Color` Fix #53 --- Cargo.toml | 2 +- src/color.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d0414e0..1b2e137 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "termion" -version = "1.1.3" +version = "1.1.4" authors = ["ticki ", "gycos "] description = "A bindless library for manipulating terminals." repository = "https://github.com/ticki/termion" diff --git a/src/color.rs b/src/color.rs index e154ae2..d6d8992 100644 --- a/src/color.rs +++ b/src/color.rs @@ -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 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. #[derive(Clone, Copy, Debug)] pub struct AnsiValue(pub u8);