summaryrefslogtreecommitdiff
path: root/src/term/cell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/term/cell.rs')
-rw-r--r--src/term/cell.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/term/cell.rs b/src/term/cell.rs
index cb966156..98d46bf2 100644
--- a/src/term/cell.rs
+++ b/src/term/cell.rs
@@ -86,6 +86,17 @@ impl Cell {
}
}
+ /// Get foreground and background colors adjusted for INVERSE flag
+ ///
+ /// First color is the foreground, second color is the background.
+ pub fn colors(&self, force_invert: bool) -> (&Color, &Color) {
+ if self.flags.contains(INVERSE) || force_invert {
+ (&self.bg, &self.fg)
+ } else {
+ (&self.fg, &self.bg)
+ }
+ }
+
#[inline]
pub fn is_empty(&self) -> bool {
self.c == ' ' &&