Skip to content

Commit

Permalink
refactor(stream): Clarify auto choice logic
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 27, 2024
1 parent 20dd3e0 commit 69a8c69
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/anstream/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ fn choice(raw: &dyn RawStream) -> ColorChoice {
let clicolor = anstyle_query::clicolor();
let clicolor_enabled = clicolor.unwrap_or(false);
let clicolor_disabled = !clicolor.unwrap_or(true);
if raw.is_terminal()
&& !anstyle_query::no_color()
&& !clicolor_disabled
if anstyle_query::clicolor_force() {
ColorChoice::Always
} else if anstyle_query::no_color() {
ColorChoice::Never
} else if clicolor_disabled {
ColorChoice::Never
} else if raw.is_terminal()
&& (anstyle_query::term_supports_color()
|| clicolor_enabled
|| anstyle_query::is_ci())
|| anstyle_query::clicolor_force()
{
ColorChoice::Always
} else {
Expand Down

0 comments on commit 69a8c69

Please sign in to comment.