diff --git a/src/lib.rs b/src/lib.rs index b062a28..c6ec679 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1511,10 +1511,12 @@ impl ColorSpec { &self, console: &mut wincolor::Console, ) -> io::Result<()> { - if let Some((intense, color)) = self.fg_color.and_then(|c| c.to_windows(self.intense)) { + let fg_color = self.fg_color.and_then(|c| c.to_windows(self.intense)); + if let Some((intense, color)) = fg_color { console.fg(intense, color)?; } - if let Some((intense, color)) = self.bg_color.and_then(|c| c.to_windows(self.intense)) { + let bg_color = self.bg_color.and_then(|c| c.to_windows(self.intense)); + if let Some((intense, color)) = bg_color { console.bg(intense, color)?; } Ok(())