Handling of NO_COLOR

Hello,

here is a improvement request.

A colleague was complaining about, that the colored output of PIO can not be disabled.

He has light colored terminal and so he was not able to read the error messages, (yellow on yellow background or so…)

Please could somebody integrate this patch (don’t have time to make a PR in the moment):

The usage of NO_COLOR is standardized at https://no-color.org/.

--- platformio/__main__.py~    2019-08-15 15:45:34.986112356 +0200
+++ platformio/__main__.py     2019-08-20 14:42:40.354806625 +0200
@@ -62,6 +62,13 @@
             click._compat.isatty = lambda stream: True
         except:  # pylint: disable=bare-except
             pass
+    # handle NO_COLOR
+    if (os.getenv("NO_COLOR") != None):
+        try:
+            # pylint: disable=protected-access
+            click._compat.isatty = lambda stream: False
+        except:  # pylint: disable=bare-except
+            pass
 
     # Handle IOError issue with VSCode's Terminal (Windows)
     click_echo_origin = [click.echo, click.secho]

Many thanks for integrating this into the code,
Best, Axel.

Thanks! We will implement it soon:

1 Like