From 86bbfcda60572af99a2e7e5089032af2d12a533b Mon Sep 17 00:00:00 2001 From: mars Date: Wed, 12 Apr 2023 12:40:16 -0400 Subject: [PATCH] Add Style::apply() --- src/theme.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/theme.rs b/src/theme.rs index 5ff0210..ae65b4c 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -142,6 +142,17 @@ impl Style { Ok(()) } + + /// Applies another [Style] on top of this one. + pub fn apply(&mut self, other: &Style) { + if other.fg.is_some() { + self.fg = other.fg; + } + + if other.bg.is_some() { + self.bg = other.bg; + } + } } #[derive(Clone, Debug, Default)]