Improve CAREFUL_LOG display on 256 color terminal

This commit is contained in:
nicolargo 2024-12-23 10:47:42 +01:00
parent c6e7281e1b
commit de8341b5b5
2 changed files with 11 additions and 4 deletions

View File

@ -77,7 +77,6 @@ class GlancesColors:
# Colors text styles
self.DEFAULT = curses.color_pair(1)
self.OK_LOG = curses.color_pair(3) | self.A_BOLD
self.NICE = curses.color_pair(8)
self.CPU_TIME = curses.color_pair(8)
self.CAREFUL_LOG = curses.color_pair(4) | self.A_BOLD
self.WARNING_LOG = curses.color_pair(5) | self.A_BOLD
@ -111,13 +110,23 @@ class GlancesColors:
# Catch exception in TMUX
pass
# Overwrite CAREFUL color
try:
if self.args.disable_bg:
curses.init_pair(12, curses.COLOR_BLUE, -1)
else:
curses.init_pair(12, -1, curses.COLOR_BLUE)
except Exception:
pass
else:
self.CAREFUL_LOG = curses.color_pair(12) | self.A_BOLD
def __define_bw(self) -> None:
# The screen is NOT compatible with a colored design
# switch to B&W text styles
# ex: export TERM=xterm-mono
self.DEFAULT = -1
self.OK_LOG = -1
self.NICE = self.A_BOLD
self.CPU_TIME = self.A_BOLD
self.CAREFUL_LOG = self.A_BOLD
self.WARNING_LOG = curses.A_UNDERLINE
@ -144,7 +153,6 @@ class GlancesColors:
'PROCESS': self.OK,
'PROCESS_SELECTED': self.OK | curses.A_UNDERLINE,
'STATUS': self.OK,
'NICE': self.NICE,
'CPU_TIME': self.CPU_TIME,
'CAREFUL': self.CAREFUL,
'WARNING': self.WARNING,

View File

@ -905,7 +905,6 @@ class GlancesPluginModel:
TITLE: for stat title
PROCESS: for process name
STATUS: for process status
NICE: for process niceness
CPU_TIME: for process cpu time
OK: Value is OK and non logged
OK_LOG: Value is OK and logged