summaryrefslogtreecommitdiffstats
path: root/src/style.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-27 13:54:49 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-27 14:02:57 -0400
commit315cc954ab66571b0c576d2ce0e01378535c2c25 (patch)
tree3b140acdfb057fe803bab7c020d0464e9fd69fa9 /src/style.rs
parentea7266594a7a470f98a309bb4c0da7359b2037e2 (diff)
Refactor: pass foreground & background defaults as a single Style
Diffstat (limited to 'src/style.rs')
-rw-r--r--src/style.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/style.rs b/src/style.rs
index dbac0863..734d3b9f 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -39,6 +39,20 @@ impl Style {
}
}
+ pub fn from_colors(
+ foreground: Option<ansi_term::Color>,
+ background: Option<ansi_term::Color>,
+ ) -> Self {
+ Self {
+ ansi_term_style: ansi_term::Style {
+ foreground,
+ background,
+ ..ansi_term::Style::new()
+ },
+ ..Self::new()
+ }
+ }
+
pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(
self,
input: I,