Honor FORCE_COLOR and NO_COLOR environment variables
Author: RedBeard0531Created Jun 27, 2025Updated Jul 12, 2026
Labelstype/feature-proposalcategory/CLI
FORCE_COLOR and NO_COLOR are semi-standard ways to forcibly enable and disable colors that work across a number of programs (more than are listed on the page). It would be good if doctest also honored them.
Since there are multiple ways to choose whether to enable colors, I think the right precedence is the following (from strongest to weakest):
- The specific
--force-colorsflag and any other programmatic ways to control colors. FORCE_COLORNO_COLOR(the order of 2 and 3 is debatable, but specifying both is rare and probably user error, so it likely doesn't matter)- fallback to
isatty()detection
Source: doctest/doctest