diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config/mod.rs | 10 | ||||
-rw-r--r-- | src/term/mod.rs | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 3cd33eac..67431e68 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -21,7 +21,7 @@ use serde::de::{MapAccess, Unexpected, Visitor}; use serde::{self, de, Deserialize}; use serde_yaml; -use crate::ansi::{Color, CursorStyle, NamedColor}; +use crate::ansi::CursorStyle; use crate::cli::Options; use crate::index::{Column, Line}; use crate::input::{Action, Binding, KeyBinding, MouseBinding}; @@ -1877,14 +1877,14 @@ impl Config { /// Cursor foreground color #[inline] - pub fn cursor_text_color(&self) -> Option<Color> { - self.colors.cursor.text.map(|_| Color::Named(NamedColor::CursorText)) + pub fn cursor_text_color(&self) -> Option<Rgb> { + self.colors.cursor.text } /// Cursor background color #[inline] - pub fn cursor_cursor_color(&self) -> Option<Color> { - self.colors.cursor.cursor.map(|_| Color::Named(NamedColor::Cursor)) + pub fn cursor_cursor_color(&self) -> Option<Rgb> { + self.colors.cursor.cursor } /// Enable experimental conpty backend (Windows only) diff --git a/src/term/mod.rs b/src/term/mod.rs index 1f8850aa..5f69fb6c 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -385,6 +385,10 @@ impl<'a> Iterator for RenderableCellsIter<'a> { renderable_cell.inner = RenderableCellContent::Raw(cursor_cell); + if let Some(color) = self.config.cursor_cursor_color() { + renderable_cell.fg = color; + } + return Some(renderable_cell); } else { let mut cell = @@ -392,6 +396,10 @@ impl<'a> Iterator for RenderableCellsIter<'a> { if self.cursor_style == CursorStyle::Block { std::mem::swap(&mut cell.bg, &mut cell.fg); + + if let Some(color) = self.config.cursor_text_color() { + cell.fg = color; + } } return Some(cell); |