Skip to content

Commit

Permalink
Improve CAREFUL_LOG display on 256 color terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 23, 2024
1 parent c6e7281 commit de8341b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 11 additions & 3 deletions glances/outputs/glances_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def __define_colors(self) -> None:
# 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
Expand Down Expand Up @@ -111,13 +110,23 @@ def __define_colors(self) -> None:
# 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
Expand All @@ -144,7 +153,6 @@ def get(self) -> dict:
'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,
Expand Down
1 change: 0 additions & 1 deletion glances/plugins/plugin/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ def curse_add_line(self, msg, decoration="DEFAULT", optional=False, additional=F
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
Expand Down

0 comments on commit de8341b

Please sign in to comment.