diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f5a30c..a0338f6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,20 @@ All user visible changes to `cucumber` crate will be documented in this file. Th +## [0.19.1] · 2022-12-?? +[0.19.1]: /../../tree/v0.19.1 + +[Diff](/../../compare/v0.19.0...v0.19.1) | [Milestone](/../../milestone/23) + +### Fixed + +- Using autodetect for colors on `color=always|never` CLI options. ([#253]) + +[#253]: /../../pull/253 + + + + ## [0.19.0] · 2022-12-16 [0.19.0]: /../../tree/v0.19.0 diff --git a/src/writer/out.rs b/src/writer/out.rs index a7438b5d..5c85a363 100644 --- a/src/writer/out.rs +++ b/src/writer/out.rs @@ -10,7 +10,7 @@ //! Tools for writing output. -use std::{borrow::Cow, io, str}; +use std::{borrow::Cow, io, mem, str}; use console::Style; use derive_more::{Deref, DerefMut, Display, From, Into}; @@ -68,11 +68,20 @@ impl Styles { /// Applies the given [`Coloring`] to these [`Styles`]. pub fn apply_coloring(&mut self, color: Coloring) { - match color { - Coloring::Auto => {} - Coloring::Always => self.is_present = true, - Coloring::Never => self.is_present = false, - } + let is_present = match color { + Coloring::Always => true, + Coloring::Never => false, + Coloring::Auto => return, + }; + + let this = mem::take(self); + self.ok = this.ok.force_styling(is_present); + self.skipped = this.skipped.force_styling(is_present); + self.err = this.err.force_styling(is_present); + self.retry = this.retry.force_styling(is_present); + self.header = this.header.force_styling(is_present); + self.bold = this.bold.force_styling(is_present); + self.is_present = is_present; } /// Returns [`Styles`] with brighter colors.