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_bigtext', 'yellow', ''),
('intro_smalltext', 'light blue', ''), ('intro_smalltext', 'light blue', ''),
('poll_bar', 'white', 'dark blue'), ('poll_bar', 'white', 'dark blue'),
('status_list_selected', 'white,bold', 'dark green'),
# Functional # Functional
('hashtag', 'light cyan,bold', ''), ('hashtag', 'light cyan,bold', ''),
('followed_hashtag', 'yellow,bold', ''), ('hashtag_followed', 'yellow,bold', ''),
('link', ',italics', ''), ('link', ',italics', ''),
('link_focused', ',italics', 'dark magenta'), ('link_focused', ',italics', 'dark magenta'),
('shortcut', 'light blue', ''),
('shortcut_highlight', 'white,bold', ''),
('warning', 'light red', ''),
# Colors # Colors
('bold', ',bold', ''), ('bold', ',bold', ''),
('blue', 'light blue', ''), ('blue', 'light blue', ''),
('blue_bold', 'light blue, bold', ''),
('blue_selected', 'white', 'dark blue'),
('cyan', 'dark cyan', ''), ('cyan', 'dark cyan', ''),
('cyan_bold', 'dark cyan,bold', ''),
('gray', 'dark gray', ''), ('gray', 'dark gray', ''),
('green', 'dark green', ''), ('green', 'dark green', ''),
('green_selected', 'white,bold', 'dark green'),
('yellow', 'yellow', ''), ('yellow', 'yellow', ''),
('yellow_bold', 'yellow,bold', ''),
('red', 'dark red', ''), ('red', 'dark red', ''),
('warning', 'light red', ''),
('white_bold', 'white,bold', '')
] ]
MONO_PALETTE = [ MONO_PALETTE = [
@ -57,28 +54,25 @@ MONO_PALETTE = [
('intro_bigtext', 'white', 'black'), ('intro_bigtext', 'white', 'black'),
('intro_smalltext', 'white', 'black'), ('intro_smalltext', 'white', 'black'),
('poll_bar', 'black', 'white'), ('poll_bar', 'black', 'white'),
('status_list_selected', 'black', 'white'),
# Functional # Functional
('hashtag_followed', 'white,bold', 'black'),
('hashtag', 'white,bold', 'black'), ('hashtag', 'white,bold', 'black'),
('followed_hashtag', 'white,bold', 'black'),
('link', ',italics', 'black'), ('link', ',italics', 'black'),
('link_focused', ',bold,italics', 'black'), ('link_focused', ',bold,italics', 'black'),
('shortcut', 'white', ''),
('shortcut_highlight', 'white,bold', ''),
# Colors # Colors
('bold', ',bold', 'black'), ('bold', ',bold', 'black'),
('blue', 'white', 'black'), ('blue', 'white', 'black'),
('blue_bold', 'white, bold', 'black'),
('blue_selected', 'white, bold', 'black'),
('cyan', 'white', 'black'), ('cyan', 'white', 'black'),
('cyan_bold', 'white,bold', 'black'),
('gray', 'white', 'black'), ('gray', 'white', 'black'),
('green', 'white', 'black'), ('green', 'white', 'black'),
('green_selected', 'black', 'white'),
('yellow', 'white', 'black'), ('yellow', 'white', 'black'),
('yellow_bold', 'white,bold', 'black'),
('red', 'white', 'black'), ('red', 'white', 'black'),
('warning', 'white,bold', 'black'), ('warning', 'white,bold', 'black'),
('white_bold', 'white,bold', 'black')
] ]
VISIBILITY_OPTIONS = [ VISIBILITY_OPTIONS = [

View file

@ -198,7 +198,7 @@ class Help(urwid.Padding):
def h(text): def h(text):
return highlight_keys(text, "cyan") 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.Divider()
yield urwid.Text(("bold", "General usage")) yield urwid.Text(("bold", "General usage"))
yield urwid.Divider() yield urwid.Divider()

View file

@ -53,7 +53,7 @@ class Timeline(urwid.Columns):
super().__init__([ super().__init__([
("weight", 40, self.status_list), ("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), ("weight", 60, status_widget),
]) ])
@ -84,12 +84,12 @@ class Timeline(urwid.Columns):
urwid.connect_signal(item, "click", lambda *args: urwid.connect_signal(item, "click", lambda *args:
self.tui.show_context_menu(status)) self.tui.show_context_menu(status))
return urwid.AttrMap(item, None, focus_map={ return urwid.AttrMap(item, None, focus_map={
"blue": "green_selected", "blue": "status_list_selected",
"green": "green_selected", "green": "status_list_selected",
"yellow": "green_selected", "yellow": "status_list_selected",
"cyan": "green_selected", "cyan": "status_list_selected",
"red": "green_selected", "red": "status_list_selected",
None: "green_selected", None: "status_list_selected",
}) })
def get_option_text(self, status: Optional[Status]) -> Optional[urwid.Text]: def get_option_text(self, status: Optional[Status]) -> Optional[urwid.Text]:
@ -113,10 +113,10 @@ class Timeline(urwid.Columns):
"[Z]oom", "[Z]oom",
"Tra[n]slate" if self.tui.can_translate else "", "Tra[n]slate" if self.tui.can_translate else "",
"Cop[y]", "Cop[y]",
"Help[?]", "Help([?])",
] ]
options = "\n" + " ".join(o for o in options if o) 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) return urwid.Text(options)
def get_focused_status(self): def get_focused_status(self):

View file

@ -35,7 +35,7 @@ def highlight_keys(text, high_attr, low_attr=""):
return list(_gen()) 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 = [] hline = []
for p in re.split(HASHTAG_PATTERN, line): for p in re.split(HASHTAG_PATTERN, line):