diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-09 18:44:58 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-09 18:44:58 -0500 |
commit | 321549c05e47c322998edba05a52d16a722f17a7 (patch) | |
tree | f5a856c2fada9591f5b13645f4c9e001b3a15a62 /src | |
parent | f1878e73c2892da9b929a11c2ee805d9b46f7e6b (diff) | |
download | nbsh-321549c05e47c322998edba05a52d16a722f17a7.tar.gz nbsh-321549c05e47c322998edba05a52d16a722f17a7.zip |
tweak colors a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/history.rs | 21 | ||||
-rw-r--r-- | src/readline.rs | 14 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/history.rs b/src/history.rs index 6c31b10..92851b9 100644 --- a/src/history.rs +++ b/src/history.rs @@ -185,7 +185,7 @@ impl HistoryEntry { scrolling: bool, offset: time::UtcOffset, ) { - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); + self.set_bgcolor(out, focused); if let Some(info) = self.exit_info { if info.status.signal().is_some() { out.set_fgcolor(textmode::color::MAGENTA); @@ -199,21 +199,14 @@ impl HistoryEntry { out.write_str(" "); } out.reset_attributes(); - if focused { - out.set_fgcolor(textmode::color::BLACK); - out.set_bgcolor(textmode::color::CYAN); - } else { - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); - } + self.set_bgcolor(out, focused); out.write_str("$ "); - out.reset_attributes(); - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); if self.running() { out.set_bgcolor(textmode::Color::Rgb(16, 64, 16)); } out.write_str(&self.cmd); out.reset_attributes(); - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); + self.set_bgcolor(out, focused); let time = if let Some(info) = self.exit_info { format!( "[{} ({:6})]", @@ -308,6 +301,14 @@ impl HistoryEntry { out.reset_attributes(); } + fn set_bgcolor(&self, out: &mut textmode::Output, focus: bool) { + if focus { + out.set_bgcolor(textmode::Color::Rgb(32, 32, 64)); + } else { + out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); + } + } + fn toggle_fullscreen(&mut self) { if let Some(fullscreen) = self.fullscreen { self.fullscreen = Some(!fullscreen); diff --git a/src/readline.rs b/src/readline.rs index 911c927..0bb304c 100644 --- a/src/readline.rs +++ b/src/readline.rs @@ -63,7 +63,11 @@ impl Readline { let timelen: u16 = time.len().try_into().unwrap(); out.move_to(self.size.0 - 2, 0); - out.set_bgcolor(textmode::Color::Rgb(32, 32, 64)); + if focus { + out.set_bgcolor(textmode::Color::Rgb(32, 32, 64)); + } else { + out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); + } out.write(b"\x1b[K"); out.write_str(" ("); out.write_str(&pwd); @@ -75,16 +79,10 @@ impl Readline { out.write_str("]"); out.move_to(self.size.0 - 1, 0); - if focus { - out.set_fgcolor(textmode::color::BLACK); - out.set_bgcolor(textmode::color::CYAN); - } else { - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); - } + out.reset_attributes(); out.write_str(&prompt_char); out.write_str(" "); out.reset_attributes(); - out.set_bgcolor(textmode::Color::Rgb(32, 32, 32)); out.write(b"\x1b[K"); out.write_str(&self.input_line); out.reset_attributes(); |