From 9933180146676762bb743c1e8013a191805d0f44 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Fri, 7 Jul 2023 13:02:18 +0200 Subject: [PATCH] Improve colour names --- toot/tui/constants.py | 24 +++++++++--------------- toot/tui/overlays.py | 2 +- toot/tui/timeline.py | 18 +++++++++--------- toot/tui/utils.py | 2 +- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/toot/tui/constants.py b/toot/tui/constants.py index cd4f508..f3647d4 100644 --- a/toot/tui/constants.py +++ b/toot/tui/constants.py @@ -16,28 +16,25 @@ PALETTE = [ ('intro_bigtext', 'yellow', ''), ('intro_smalltext', 'light blue', ''), ('poll_bar', 'white', 'dark blue'), + ('status_list_selected', 'white,bold', 'dark green'), # Functional ('hashtag', 'light cyan,bold', ''), - ('followed_hashtag', 'yellow,bold', ''), + ('hashtag_followed', 'yellow,bold', ''), ('link', ',italics', ''), ('link_focused', ',italics', 'dark magenta'), + ('shortcut', 'light blue', ''), + ('shortcut_highlight', 'white,bold', ''), + ('warning', 'light red', ''), # Colors ('bold', ',bold', ''), ('blue', 'light blue', ''), - ('blue_bold', 'light blue, bold', ''), - ('blue_selected', 'white', 'dark blue'), ('cyan', 'dark cyan', ''), - ('cyan_bold', 'dark cyan,bold', ''), ('gray', 'dark gray', ''), ('green', 'dark green', ''), - ('green_selected', 'white,bold', 'dark green'), ('yellow', 'yellow', ''), - ('yellow_bold', 'yellow,bold', ''), ('red', 'dark red', ''), - ('warning', 'light red', ''), - ('white_bold', 'white,bold', '') ] MONO_PALETTE = [ @@ -57,28 +54,25 @@ MONO_PALETTE = [ ('intro_bigtext', 'white', 'black'), ('intro_smalltext', 'white', 'black'), ('poll_bar', 'black', 'white'), + ('status_list_selected', 'black', 'white'), # Functional + ('hashtag_followed', 'white,bold', 'black'), ('hashtag', 'white,bold', 'black'), - ('followed_hashtag', 'white,bold', 'black'), ('link', ',italics', 'black'), ('link_focused', ',bold,italics', 'black'), + ('shortcut', 'white', ''), + ('shortcut_highlight', 'white,bold', ''), # Colors ('bold', ',bold', 'black'), ('blue', 'white', 'black'), - ('blue_bold', 'white, bold', 'black'), - ('blue_selected', 'white, bold', 'black'), ('cyan', 'white', 'black'), - ('cyan_bold', 'white,bold', 'black'), ('gray', 'white', 'black'), ('green', 'white', 'black'), - ('green_selected', 'black', 'white'), ('yellow', 'white', 'black'), - ('yellow_bold', 'white,bold', 'black'), ('red', 'white', 'black'), ('warning', 'white,bold', 'black'), - ('white_bold', 'white,bold', 'black') ] VISIBILITY_OPTIONS = [ diff --git a/toot/tui/overlays.py b/toot/tui/overlays.py index fbb394b..5b55afb 100644 --- a/toot/tui/overlays.py +++ b/toot/tui/overlays.py @@ -198,7 +198,7 @@ class Help(urwid.Padding): def h(text): return highlight_keys(text, "cyan") - yield urwid.Text(("yellow_bold", "toot {}".format(__version__))) + yield urwid.Text(("bold", "toot {}".format(__version__))) yield urwid.Divider() yield urwid.Text(("bold", "General usage")) yield urwid.Divider() diff --git a/toot/tui/timeline.py b/toot/tui/timeline.py index 5928cce..2123f77 100644 --- a/toot/tui/timeline.py +++ b/toot/tui/timeline.py @@ -53,7 +53,7 @@ class Timeline(urwid.Columns): super().__init__([ ("weight", 40, self.status_list), - ("weight", 0, urwid.AttrWrap(urwid.SolidFill("│"), "blue_selected")), + ("weight", 0, urwid.AttrWrap(urwid.SolidFill("│"), "columns_divider")), ("weight", 60, status_widget), ]) @@ -84,12 +84,12 @@ class Timeline(urwid.Columns): urwid.connect_signal(item, "click", lambda *args: self.tui.show_context_menu(status)) return urwid.AttrMap(item, None, focus_map={ - "blue": "green_selected", - "green": "green_selected", - "yellow": "green_selected", - "cyan": "green_selected", - "red": "green_selected", - None: "green_selected", + "blue": "status_list_selected", + "green": "status_list_selected", + "yellow": "status_list_selected", + "cyan": "status_list_selected", + "red": "status_list_selected", + None: "status_list_selected", }) def get_option_text(self, status: Optional[Status]) -> Optional[urwid.Text]: @@ -113,10 +113,10 @@ class Timeline(urwid.Columns): "[Z]oom", "Tra[n]slate" if self.tui.can_translate else "", "Cop[y]", - "Help[?]", + "Help([?])", ] options = "\n" + " ".join(o for o in options if o) - options = highlight_keys(options, "white_bold", "cyan") + options = highlight_keys(options, "shortcut_highlight", "shortcut") return urwid.Text(options) def get_focused_status(self): diff --git a/toot/tui/utils.py b/toot/tui/utils.py index 3c9bf37..377522b 100644 --- a/toot/tui/utils.py +++ b/toot/tui/utils.py @@ -35,7 +35,7 @@ def highlight_keys(text, high_attr, low_attr=""): return list(_gen()) -def highlight_hashtags(line, followed_tags, attr="hashtag", followed_attr="followed_hashtag"): +def highlight_hashtags(line, followed_tags, attr="hashtag", followed_attr="hashtag_followed"): hline = [] for p in re.split(HASHTAG_PATTERN, line):