diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-04-27 03:40:06 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-04-27 03:40:06 -0400 |
commit | 06445fe6e42f44bbb14f00afee97865b58250a70 (patch) | |
tree | e0d5d7382c91b5902a3042cded6a548a29c50750 /src/screen.rs | |
parent | de82973a9e4a5d50547587b7f3aa092223240826 (diff) | |
download | vt100-rust-06445fe6e42f44bbb14f00afee97865b58250a70.tar.gz vt100-rust-06445fe6e42f44bbb14f00afee97865b58250a70.zip |
fgcolor and bgcolor for the screen
Diffstat (limited to 'src/screen.rs')
-rw-r--r-- | src/screen.rs | 21 |
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 { |