Improve colour names

This commit is contained in:
Ivan Habunek 2023-07-07 13:02:18 +02:00
parent 089e9f7d2f
commit 9933180146
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
4 changed files with 20 additions and 26 deletions

View File

@ -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 = [

View File

@ -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()

View File

@ -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):

View File

@ -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):