Merge pull request #738 from okdana/issue#68

Add option to disable ANSI background colours.

Thanks for the contribution @okdana !
This commit is contained in:
Nicolas Hennion 2015-12-02 16:34:21 +01:00
commit a1ef0b75e8
4 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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,

View File

@ -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)

View File

@ -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