summaryrefslogtreecommitdiff
path: root/poezio/windows/info_bar.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/windows/info_bar.py')
-rw-r--r--poezio/windows/info_bar.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/poezio/windows/info_bar.py b/poezio/windows/info_bar.py
index 67b68888..6e6c3bbd 100644
--- a/poezio/windows/info_bar.py
+++ b/poezio/windows/info_bar.py
@@ -15,6 +15,7 @@ from poezio.config import config
from poezio.windows.base_wins import Win
from poezio.theming import get_theme, to_curses_attr
from poezio.common import unique_prefix_of
+from poezio.colors import ccg_text_to_color
log = logging.getLogger(__name__)
@@ -38,6 +39,7 @@ class GlobalInfoBar(Win):
use_nicks = config.getbool('use_tab_nicks')
show_inactive = config.getbool('show_inactive_tabs')
unique_prefix_tab_names = config.getbool('unique_prefix_tab_names')
+ autocolor_tab_names = config.getbool('autocolor_tab_names')
if unique_prefix_tab_names:
unique_prefixes: List[Optional[str]] = [None] * len(self.core.tabs)
@@ -73,6 +75,24 @@ class GlobalInfoBar(Win):
if not show_inactive and color is theme.COLOR_TAB_NORMAL and (
tab.priority < 0):
continue
+ if autocolor_tab_names:
+ # TODO: in case of private MUC conversations, we should try to
+ # get hold of more information to make the colour the same as
+ # the nickname colour in the MUC.
+ fgcolor, bgcolor, *flags = color
+ # this is fugly, but I’m not sure how to improve it... since
+ # apparently the state is only kept in the color -.-
+ if (color == theme.COLOR_TAB_HIGHLIGHT or
+ color == theme.COLOR_TAB_PRIVATE):
+ fgcolor = ccg_text_to_color(theme.ccg_palette, tab.name)
+ bgcolor = -1
+ flags = theme.MODE_TAB_IMPORTANT
+ elif color == theme.COLOR_TAB_NEW_MESSAGE:
+ fgcolor = ccg_text_to_color(theme.ccg_palette, tab.name)
+ bgcolor = -1
+ flags = theme.MODE_TAB_NORMAL
+
+ color = (fgcolor, bgcolor) + tuple(flags)
try:
if show_nums or not show_names:
self.addstr("%s" % str(nb), to_curses_attr(color))