aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-03-06 23:25:32 -0500
committerJesse Luehrs <doy@tozt.net>2021-03-06 23:25:32 -0500
commit67df88853835ca1646a953f1bcec1ccf3893f3c6 (patch)
tree0717fdc1b19291e442569180bb28c7aebf0b0b13
parent9ec5c4002f5f953604ac5dbcb4e32607ce727697 (diff)
downloadvt100-rust-67df88853835ca1646a953f1bcec1ccf3893f3c6.tar.gz
vt100-rust-67df88853835ca1646a953f1bcec1ccf3893f3c6.zip
add methods to retrieve the current drawing state attributes
-rw-r--r--src/screen.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/screen.rs b/src/screen.rs
index 4d91bfe..3d242aa 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -568,6 +568,46 @@ impl Screen {
self.mouse_protocol_encoding
}
+ /// Returns the currently active foreground color.
+ #[must_use]
+ pub fn fgcolor(&self) -> crate::attrs::Color {
+ self.attrs.fgcolor
+ }
+
+ /// Returns the currently active background color.
+ #[must_use]
+ pub fn bgcolor(&self) -> crate::attrs::Color {
+ self.attrs.bgcolor
+ }
+
+ /// Returns whether newly drawn text should be rendered with the bold text
+ /// attribute.
+ #[must_use]
+ pub fn bold(&self) -> bool {
+ self.attrs.bold()
+ }
+
+ /// Returns whether newly drawn text should be rendered with the italic
+ /// text attribute.
+ #[must_use]
+ pub fn italic(&self) -> bool {
+ self.attrs.italic()
+ }
+
+ /// Returns whether newly drawn text should be rendered with the
+ /// underlined text attribute.
+ #[must_use]
+ pub fn underline(&self) -> bool {
+ self.attrs.underline()
+ }
+
+ /// Returns whether newly drawn text should be rendered with the inverse
+ /// text attribute.
+ #[must_use]
+ pub fn inverse(&self) -> bool {
+ self.attrs.inverse()
+ }
+
fn grid(&self) -> &crate::grid::Grid {
if self.mode(Mode::AlternateScreen) {
&self.alternate_grid