]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-140693: Improve `argparse` documentation about controlling color (GH-140737...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 3 Nov 2025 05:08:47 +0000 (06:08 +0100)
committerGitHub <noreply@github.com>
Mon, 3 Nov 2025 05:08:47 +0000 (21:08 -0800)
gh-140693: Improve `argparse` documentation about controlling color (GH-140737)
(cherry picked from commit 31de83d5e2e17f4e9a37e08b384bab916e1da7c1)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
Doc/library/argparse.rst

index a7603ac272633d3256e26b33481bc8e2277fbb23..0ee921e15260c4fe261d1ed6de9b44d5da11d229 100644 (file)
@@ -639,6 +639,11 @@ by setting ``color`` to ``False``::
    ...                     help='an integer for the accumulator')
    >>> parser.parse_args(['--help'])
 
+Note that when ``color=True``, colored output depends on both environment
+variables and terminal capabilities.  However, if ``color=False``, colored
+output is always disabled, even if environment variables like ``FORCE_COLOR``
+are set.
+
 .. versionadded:: 3.14