aboutsummaryrefslogtreecommitdiff
path: root/src/term/cell.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-04 11:14:27 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-11 20:23:41 -0800
commit23e36f19255db60084c2c240a166d137f6c12c3e (patch)
tree8f37cb27e0c9ed218e26bddc691b3ae15824e50e /src/term/cell.rs
parent3151ef862596bbfc69b2941765f2574348d85a8f (diff)
downloadalacritty-23e36f19255db60084c2c240a166d137f6c12c3e.tar.gz
alacritty-23e36f19255db60084c2c240a166d137f6c12c3e.zip
Add support for indexed colors
ANSI escape sequences like `\x1b[48;5;10m` were not supported until now. Specifically, the second attribute, 5, says that the following attribute is a color index. The ref tests were updated since `enum Color` variants changed.
Diffstat (limited to 'src/term/cell.rs')
-rw-r--r--src/term/cell.rs11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/term/cell.rs b/src/term/cell.rs
index 506fde0e..df648294 100644
--- a/src/term/cell.rs
+++ b/src/term/cell.rs
@@ -15,8 +15,7 @@
use std::mem;
-use ansi;
-use Rgb;
+use ansi::{NamedColor, Color};
bitflags! {
#[derive(Serialize, Deserialize)]
@@ -28,12 +27,6 @@ bitflags! {
}
}
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub enum Color {
- Rgb(Rgb),
- Ansi(ansi::Color),
-}
-
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct Cell {
pub c: char,
@@ -59,7 +52,7 @@ impl Cell {
#[inline]
pub fn is_empty(&self) -> bool {
self.c == ' ' &&
- self.bg == Color::Ansi(ansi::Color::Background) &&
+ self.bg == Color::Named(NamedColor::Background) &&
!self.flags.contains(INVERSE)
}