From 9e2e1a1bc0f0a03e03a6e370ce91536bc2443774 Mon Sep 17 00:00:00 2001 From: iximeow Date: Wed, 17 Apr 2019 18:17:27 -0700 Subject: add color for program counter register (default to the same as ret and friends) --- src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 86c8a2d..b62d52f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -167,6 +167,7 @@ pub struct ColorSettings { misc: color::Fg<&'static color::Color>, register: color::Fg<&'static color::Color>, + program_counter: color::Fg<&'static color::Color>, number: color::Fg<&'static color::Color>, zero: color::Fg<&'static color::Color>, @@ -205,6 +206,7 @@ impl Default for ColorSettings { misc: color::Fg(&color::LightCyan), register: color::Fg(&color::Cyan), + program_counter: color::Fg(&color::Red), number: color::Fg(&color::White), zero: color::Fg(&color::White), @@ -230,6 +232,7 @@ pub trait YaxColors { fn platform_op(&self, t: T) -> Colored; fn register(&self, t: T) -> Colored; + fn program_counter(&self, t: T) -> Colored; fn number(&self, t: T) -> Colored; fn zero(&self, t: T) -> Colored; fn one(&self, t: T) -> Colored; @@ -271,6 +274,9 @@ impl YaxColors for ColorSettings { fn register(&self, t: T) -> Colored { Colored::Color(t, self.register) } + fn program_counter(&self, t: T) -> Colored { + Colored::Color(t, self.program_counter) + } fn number(&self, t: T) -> Colored { Colored::Color(t, self.number) } @@ -356,6 +362,12 @@ impl <'a> YaxColors for Option<&'a ColorSettings> { None => { Colored::Just(t) } } } + fn program_counter(&self, t: T) -> Colored { + match self { + Some(colors) => { colors.program_counter(t) } + None => { Colored::Just(t) } + } + } fn number(&self, t: T) -> Colored { match self { Some(colors) => { colors.number(t) } -- cgit v1.1