From 45c9fdf5b46155aa5be80b13d748955afbb35575 Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Wed, 29 Oct 2025 11:07:17 +0530 Subject: [PATCH 1/3] commit --- Doc/library/argparse.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 418f514995df3a..5948113983b4eb 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -638,6 +638,17 @@ by setting ``color`` to ``False``:: ... help='an integer for the accumulator') >>> parser.parse_args(['--help']) +Note that the environment variables take precedence over ``color=True``, but +``color=False`` takes precedence over the environment variables. For +instance, if the environment variable ``NO_COLOR`` is set then there will be +no colored output even if the ``color`` parameter is explicitly set to +``True``. If the environment variable ``FORCE_COLOR`` is set then colored +output will be depending on the ``color`` parameter. If both are set then +``NO_COLOR`` takes precedence. + +See :ref:`controlling color ` for more information +on controlling colored output globally. + .. versionadded:: 3.14 From 21c7a365731b43a28985e7ce311f97e464056c45 Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Thu, 30 Oct 2025 09:44:28 +0530 Subject: [PATCH 2/3] suggestion --- Doc/library/argparse.rst | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 5948113983b4eb..22bcf40763e567 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -638,16 +638,9 @@ by setting ``color`` to ``False``:: ... help='an integer for the accumulator') >>> parser.parse_args(['--help']) -Note that the environment variables take precedence over ``color=True``, but -``color=False`` takes precedence over the environment variables. For -instance, if the environment variable ``NO_COLOR`` is set then there will be -no colored output even if the ``color`` parameter is explicitly set to -``True``. If the environment variable ``FORCE_COLOR`` is set then colored -output will be depending on the ``color`` parameter. If both are set then -``NO_COLOR`` takes precedence. - -See :ref:`controlling color ` for more information -on controlling colored output globally. +When ``color=True``, colored output depends on both the environment variables +and the terminal capabilities. But when ``color=False``, colored output is +always disabled. .. versionadded:: 3.14 From 4c3513cc6d164f69c3fadcb05077c05bd439ecdf Mon Sep 17 00:00:00 2001 From: Bonu Krishna Chaitanya Date: Thu, 30 Oct 2025 10:49:56 +0530 Subject: [PATCH 3/3] suggestion --- Doc/library/argparse.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 22bcf40763e567..9655db4f301a31 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -638,9 +638,10 @@ by setting ``color`` to ``False``:: ... help='an integer for the accumulator') >>> parser.parse_args(['--help']) -When ``color=True``, colored output depends on both the environment variables -and the terminal capabilities. But when ``color=False``, colored output is -always disabled. +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