fix: keep termynal color when NO_COLOR is set (e.g. ReadTheDocs) - #39
Merged
Conversation
The capture Console in _colored_help opted into a terminal palette via
force_terminal + color_system but left rich's separate no_color flag at
its default of ("NO_COLOR" in os.environ). In build environments that set
NO_COLOR (ReadTheDocs does), foreground colors were silently stripped from
the generated help, even though the output is a build artifact converted
to HTML rather than interactive terminal text.
Pass no_color=False so the declared intent to produce color is robust
across build environments, and add a regression test that renders with
NO_COLOR set.
Closes syn54x#38
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0x054
approved these changes
Jun 17, 2026
Contributor
|
No problem! Thanks. |
0x054
added a commit
that referenced
this pull request
Jun 17, 2026
## Summary Prepare **0.4.1** for release: - Bump `version` in `pyproject.toml` to `0.4.1` - Document the termynal `NO_COLOR` fix merged since `0.4.0` in `CHANGELOG.md` ## Changes in 0.4.1 - **Fixed:** Termynal mode keeps colors when `NO_COLOR` is set in the build environment (e.g. ReadTheDocs) ([#39](#39), [#38](#38)) ## After merge 1. Create GitHub Release `v0.4.1` (publish) to trigger PyPI upload via `publish.yml` 2. Docs site updates automatically on merge to `main` ## Test plan - [x] Changelog and version bump only - [x] `uv run pytest` passes locally (109 tests) Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sorry for the churn. Only happened in ci on ReadTheDocs...
Closes #38.
Problem
Termynal mode captures a Typer/Click app's
--helpwith color by forcing a terminal intermynal_render._colored_help. The captureConsoleopts into a palette viaforce_terminal=True+color_system="standard", but rich'sno_coloris a separate flag that defaults to("NO_COLOR" in os.environ). In any build environment that setsNO_COLOR— ReadTheDocs does — every foreground color is stripped and the help renders monochrome. The build still succeeds, so the regression is silent. (FORCE_COLOR=1does not help:NO_COLORtakes precedence in rich.)Fix
Pass
no_color=Falseto the captureConsole. We've already declared intent to produce color viaforce_terminal=True+color_system="standard"; this makes that intent robust across build environments. The output here isn't interactive terminal text — it's ANSI converted to HTML spans for a docs page — so honoringNO_COLORwas a category error. The rationale lives in the_colored_helpdocstring.Tests
Adds
test_render_termynal_html_keeps_color_when_no_color_set, which setsNO_COLOR=1and asserts color spans survive. Verified it fails without the fix and passes with it. Full termynal suite passes;ruff format --checkandruff checkare clean.A
[Unreleased] → FixedCHANGELOG entry is added.🤖 Generated with Claude Code