diff options
author | Peter A. Bigot <pab@pabigot.com> | 2024-03-11 18:08:49 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-03-21 12:39:25 +0000 |
commit | d9986c54cd3d67ed1f7cb636b17696c8d0d4db85 (patch) | |
tree | e6bb9dec77956ffa1ce863e1c764875a7c02f6b0 /lib/bb/msg.py | |
parent | 12f9738577934ad7c99f0770f1392a9d6050e7d6 (diff) | |
download | bitbake-contrib-d9986c54cd3d67ed1f7cb636b17696c8d0d4db85.tar.gz |
lib/bb: support NO_COLOR
Red text on a black background can make it difficult for people with
visual impairments to read the text of error messages. Respect the
presence of a non-empty NO_COLOR environment variable as an indication
the user doesn't want colorization to be automatically enabled.
See: https://no-color.org/
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/msg.py')
-rw-r--r-- | lib/bb/msg.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bb/msg.py b/lib/bb/msg.py index 93575d89c..3e18596fa 100644 --- a/lib/bb/msg.py +++ b/lib/bb/msg.py @@ -230,7 +230,7 @@ def logger_create(name, output=sys.stderr, level=logging.INFO, preserve_handlers console = logging.StreamHandler(output) console.addFilter(bb.msg.LogFilterShowOnce()) format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") - if color == 'always' or (color == 'auto' and output.isatty()): + if color == 'always' or (color == 'auto' and output.isatty() and os.environ.get('NO_COLOR', '') == ''): format.enable_color() console.setFormatter(format) if preserve_handlers: |