Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Should CI environments infer `ColorChoice::Always`?

Open
#291 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
cli

Research direction

Start by reading crates/anstream/src/auto.rs at the linked lines and trace how raw.is_terminal() and anstyle_query::is_ci() determine the color choice. Resolve whether CI alone should select ColorChoice::Always, including the noted ANSI and OSC-code concerns, and verify the resulting behavior in CI and non-terminal environments.

Written by the indexing model from the issue text.

Description

Context: I was trying to figure out why CI environments (i.e. CI=true and similar) weren't being colorized by default when using anstream to plumb output containing ANSI colors. I ended up on this choice implementation:

https://github.com/rust-cli/anstyle/blob/cbad464298a5b2b844dc9055ddcd7e4abde9d865/crates/anstream/src/auto.rs#L197-L223

If my read of that helper is right, the current logic only considers anstyle_query::is_ci() after raw.is_terminal() is satisfied. In practice that means that ColorChoice::Always branch won't be taken for CI environments, since (AFAIK) most CI environments don't actually provide a terminal (they support ANSI color codes, but they won't provide a true pty that would pass is is_terminal() check).

Given that, does it makes sense to split that check out, so that is_ci() becomes a sufficient condition for ColorChoice::Always? My intuition is "yes" (since the CI check seems to be a no-op as is), but there's also some nuance given that CI environments aren't real terminals and might only support a small subset of the escapes normally accepted by terminals (things like OSC codes in particular).

So, I don't have a super clear sense here, but I figured I'd open this in case others have a clearer picture than I do 😅. If this change makes sense, I'd be happy to send a PR for it.

Dominant language
HTML
Stars
171
Forks
44
Avg merge
3h 4m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-cli/anstyle

All issues in rust-cli/anstyle

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.