about summary refs log tree commit diff
path: root/src/entities/entity_char.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/entity_char.rs')
-rw-r--r--src/entities/entity_char.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/entities/entity_char.rs b/src/entities/entity_char.rs
new file mode 100644
index 000000000000..578aaf3da5c3
--- /dev/null
+++ b/src/entities/entity_char.rs
@@ -0,0 +1,22 @@
+use crate::display::color::Color;
+use std::fmt::{self, Display, Formatter};
+use termion::color;
+
+#[derive(Debug, Deserialize)]
+pub struct EntityChar {
+    color: Color,
+    #[serde(rename = "char")]
+    chr: char,
+}
+
+impl Display for EntityChar {
+    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+        write!(
+            f,
+            "{}{}{}",
+            color::Fg(&self.color),
+            self.chr,
+            color::Fg(color::Reset)
+        )
+    }
+}