diff --git a/tests/test_constants.py b/tests/test_constants.py deleted file mode 100644 index 60a15cf..0000000 --- a/tests/test_constants.py +++ /dev/null @@ -1,15 +0,0 @@ -from toot.tui.constants import PALETTE, MONO_PALETTE - - -def test_palette(): - # for every entry in PALETTE, there must be - # a corresponding entry in MONO_PALETTE - for pal in PALETTE: - matches = [item for item in MONO_PALETTE if item[0] == pal[0]] - assert len(matches) > 0, f"{pal}, present in PALETTE, missing from MONO_PALETTE" - - # for every entry in MONO_PALETTE, there must be - # a corresponding entry in PALETTE - for pal in MONO_PALETTE: - matches = [item for item in PALETTE if item[0] == pal[0]] - assert len(matches) > 0, f"{pal}, present in MONO_PALETTE, missing from PALETTE" diff --git a/toot/tui/app.py b/toot/tui/app.py index 833cb0b..9d78b12 100644 --- a/toot/tui/app.py +++ b/toot/tui/app.py @@ -8,7 +8,7 @@ from toot.console import get_default_visibility from toot.exceptions import ApiError from .compose import StatusComposer -from .constants import PALETTE, MONO_PALETTE +from .constants import PALETTE from .entities import Status from .overlays import ExceptionStackTrace, GotoMenu, Help, StatusSource, StatusLinks, StatusZoom from .overlays import StatusDeleteConfirmation, Account @@ -84,7 +84,7 @@ class TUI(urwid.Frame): screen = TUI.create_screen(args) tui = TUI(app, user, screen, args) - palette = MONO_PALETTE if args.no_color else PALETTE + palette = PALETTE.copy() overrides = settings.get_setting("tui.palette", dict, {}) for name, styles in overrides.items(): palette.append(tuple([name] + styles)) diff --git a/toot/tui/constants.py b/toot/tui/constants.py index 8e2bddf..91bb3b7 100644 --- a/toot/tui/constants.py +++ b/toot/tui/constants.py @@ -1,8 +1,19 @@ -# name, fg, bg, mono, fg_h, bg_h +# Color definitions are tuples of: +# - name +# - foreground (normal mode) +# - background (normal mode) +# - foreground (monochrome mode) +# - foreground (high color mode) +# - background (high color mode) +# +# See: +# http://urwid.org/tutorial/index.html#display-attributes +# http://urwid.org/manual/displayattributes.html#using-display-attributes + PALETTE = [ # Components ('button', 'white', 'black'), - ('button_focused', 'light gray', 'dark magenta'), + ('button_focused', 'light gray', 'dark magenta', 'bold,underline'), ('card_author', 'yellow', ''), ('card_title', 'dark green', ''), ('columns_divider', 'white', 'dark blue'), @@ -14,7 +25,7 @@ PALETTE = [ ('footer_status', 'white', 'dark blue'), ('footer_status_bold', 'white, bold', 'dark blue'), ('header', 'white', 'dark blue'), - ('header_bold', 'white,bold', 'dark blue'), + ('header_bold', 'white,bold', 'dark blue', 'bold'), ('intro_bigtext', 'yellow', ''), ('intro_smalltext', 'light blue', ''), ('poll_bar', 'white', 'dark blue'), @@ -22,17 +33,17 @@ PALETTE = [ ('status_detail_bookmarked', 'light red', ''), ('status_detail_timestamp', 'light blue', ''), ('status_list_account', 'dark green', ''), - ('status_list_selected', 'white,bold', 'dark green'), + ('status_list_selected', 'white,bold', 'dark green', 'bold,underline'), ('status_list_timestamp', 'light blue', ''), # Functional ('account', 'dark green', ''), - ('hashtag', 'light cyan,bold', ''), - ('hashtag_followed', 'yellow,bold', ''), - ('link', ',italics', ''), - ('link_focused', ',italics', 'dark magenta'), + ('hashtag', 'light cyan,bold', '', 'bold'), + ('hashtag_followed', 'yellow,bold', '', 'bold'), + ('link', ',italics', '', ',italics'), + ('link_focused', ',italics', 'dark magenta', "underline,italics"), ('shortcut', 'light blue', ''), - ('shortcut_highlight', 'white,bold', ''), + ('shortcut_highlight', 'white,bold', '', 'bold'), ('warning', 'light red', ''), # Visiblity @@ -48,55 +59,6 @@ PALETTE = [ ('success', 'dark green', ''), ] -MONO_PALETTE = [ - # Components - ('button', 'white', 'black'), - ('button_focused', 'black', 'white'), - ('card_author', 'white', ''), - ('card_title', 'white, bold', ''), - ('columns_divider', 'white', 'black'), - ('content_warning', 'white', 'black'), - ('editbox', 'white', 'black'), - ('editbox_focused', 'black', 'white'), - ('footer_message', 'white', 'black'), - ('footer_message_error', 'white,bold', 'black'), - ('footer_status', 'black', 'white'), - ('footer_status_bold', 'black,bold', 'white'), - ('header', 'black', 'white'), - ('header_bold', 'black,bold', 'white'), - ('intro_bigtext', 'white', 'black'), - ('intro_smalltext', 'white', 'black'), - ('poll_bar', 'black', 'white'), - ('status_detail_account', 'white', ''), - ('status_detail_bookmarked', 'white', ''), - ('status_detail_timestamp', 'white', ''), - ('status_list_account', 'white', ''), - ('status_list_selected', 'white,bold', ''), - ('status_list_timestamp', 'white', ''), - ('warning', 'white,bold', 'black'), - - # Functional - ('account', 'white', ''), - ('hashtag_followed', 'white,bold', ''), - ('hashtag', 'white,bold', ''), - ('link', ',italics', ''), - ('link_focused', ',bold,italics', ''), - ('shortcut', 'white', ''), - ('shortcut_highlight', 'white,bold', ''), - - # Visiblity - ('visibility_public', 'white', ''), - ('visibility_unlisted', 'white', ''), - ('visibility_private', 'white', ''), - ('visibility_direct', 'white', ''), - - # Styles - ('bold', ',bold', ''), - ('dim', 'light gray', ''), - ('highlight', ',bold', ''), - ('success', '', ''), -] - VISIBILITY_OPTIONS = [ ("public", "Public", "Post to public timelines"), ("unlisted", "Unlisted", "Do not post to public timelines"),