]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-140693: Improve `argparse` documentation about controlling color (#140737)
authorKrishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
Sun, 2 Nov 2025 21:58:16 +0000 (03:28 +0530)
committerGitHub <noreply@github.com>
Sun, 2 Nov 2025 21:58:16 +0000 (13:58 -0800)
Doc/library/argparse.rst

index 418f514995df3a9cf9748b54f1b5208ace29c860..9655db4f301a319d0916bbd4a290fac7533f9a5b 100644 (file)
@@ -638,6 +638,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