From ed83538ee13b1156dae73a7b06ff94be057a37b5 Mon Sep 17 00:00:00 2001 From: dana Date: Tue, 1 Dec 2015 11:31:52 -0600 Subject: [PATCH 1/2] Add option to disable ANSI background colours Adds new command-line option `--disable-bg` to address issue #68 (readability problems with white text over coloured backgrounds). --- glances/main.py | 2 ++ glances/outputs/glances_curses.py | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/glances/main.py b/glances/main.py index dc903053..f48c91c1 100644 --- a/glances/main.py +++ b/glances/main.py @@ -137,6 +137,8 @@ Start the client browser (browser mode):\n\ dest='disable_log', help='disable log module') parser.add_argument('--disable-bold', action='store_false', default=True, dest='disable_bold', help='disable bold mode in the terminal') + parser.add_argument('--disable-bg', action='store_false', default=True, + dest='disable_bg', help='disable background colors in the terminal') parser.add_argument('--enable-process-extended', action='store_true', default=False, dest='enable_process_extended', help='enable extended stats on top process') parser.add_argument('--enable-history', action='store_true', default=False, diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 70b77ded..969d0e9c 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -145,10 +145,16 @@ class _GlancesCurses(object): curses.init_pair(1, curses.COLOR_BLACK, -1) else: curses.init_pair(1, curses.COLOR_WHITE, -1) - curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_RED) - curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_GREEN) - curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLUE) - curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_MAGENTA) + if args.disable_bg: + curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_RED) + curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_GREEN) + curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLUE) + curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_MAGENTA) + else: + curses.init_pair(2, curses.COLOR_RED, -1) + curses.init_pair(3, curses.COLOR_GREEN, -1) + curses.init_pair(4, curses.COLOR_BLUE, -1) + curses.init_pair(5, curses.COLOR_MAGENTA, -1) curses.init_pair(6, curses.COLOR_RED, -1) curses.init_pair(7, curses.COLOR_GREEN, -1) curses.init_pair(8, curses.COLOR_BLUE, -1) From e70a041aee6d67c764b558b0816b2eed1ea23335 Mon Sep 17 00:00:00 2001 From: dana Date: Tue, 1 Dec 2015 11:32:05 -0600 Subject: [PATCH 2/2] Document --disable-bg option --- docs/glances-doc.rst | 1 + man/glances.1 | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/glances-doc.rst b/docs/glances-doc.rst index c6dcedfd..8f03db10 100644 --- a/docs/glances-doc.rst +++ b/docs/glances-doc.rst @@ -169,6 +169,7 @@ Command-Line Options sensors modules (py3sensors needed) --disable-process disable process module --disable-log disable log module + --disable-bg disable background colors in the terminal --disable-bold disable bold mode in the terminal --enable-process-extended enable extended stats on top process diff --git a/man/glances.1 b/man/glances.1 index 610dd7f0..72201903 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -87,6 +87,9 @@ disable process module .B \-\-disable-log disable log module .TP +.B \-\-disable-bg +disable background colors in the terminal +.TP .B \-\-disable-bold disable bold mode in the terminal .TP