aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/screen.rs')
-rw-r--r--src/screen.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/screen.rs b/src/screen.rs
index 212da51..7b6e2a2 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -2,6 +2,7 @@ use libc;
use std;
use cell;
+use color;
use ffi;
use types;
@@ -22,6 +23,8 @@ struct ScreenPrefix {
title_len: libc::size_t,
icon_name: *mut libc::c_char,
icon_name_len: libc::size_t,
+
+ attrs: types::CellAttrs,
}
impl Screen {
@@ -174,6 +177,24 @@ impl Screen {
Some(std::str::from_utf8(slice).unwrap())
}
}
+
+ pub fn fgcolor(&self) -> color::Color {
+ let Screen(screen_impl) = *self;
+ let prefix: *mut ScreenPrefix = unsafe {
+ std::mem::transmute(screen_impl)
+ };
+ let attrs = unsafe { &(*prefix).attrs };
+ color::Color::new(&attrs.fgcolor)
+ }
+
+ pub fn bgcolor(&self) -> color::Color {
+ let Screen(screen_impl) = *self;
+ let prefix: *mut ScreenPrefix = unsafe {
+ std::mem::transmute(screen_impl)
+ };
+ let attrs = unsafe { &(*prefix).attrs };
+ color::Color::new(&attrs.bgcolor)
+ }
}
impl Drop for Screen {