From 95cf7b373f24c7ca563b573351a72f9712a59302 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 28 Aug 2021 21:30:27 +0200 Subject: [PATCH] Color adjustments. --- nomadnet/ui/TextUI.py | 1 + nomadnet/ui/textui/Browser.py | 4 ++-- nomadnet/ui/textui/Guide.py | 4 +++- nomadnet/ui/textui/MicronParser.py | 19 +++++++++++-------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/nomadnet/ui/TextUI.py b/nomadnet/ui/TextUI.py index d099b79..52c3ca2 100644 --- a/nomadnet/ui/TextUI.py +++ b/nomadnet/ui/TextUI.py @@ -43,6 +43,7 @@ THEMES = { ("list_untrusted", "dark red", "default", "default", "#a22", "default"), ("list_focus_untrusted", "black", "light gray", "standout", "#810", "#aaa"), ("topic_list_normal", "white", "default", "default", "#ddd", "default"), + ('browser_controls', "light gray", 'default', 'default', '#bbb', 'default'), ("progress_full", "black", "light gray", "standout", "#111", "#bbb"), ("progress_empty", "light gray", "default", "default", "#ddd", "default"), ], diff --git a/nomadnet/ui/textui/Browser.py b/nomadnet/ui/textui/Browser.py index ee71f42..c9465c1 100644 --- a/nomadnet/ui/textui/Browser.py +++ b/nomadnet/ui/textui/Browser.py @@ -110,10 +110,10 @@ class Browser: else: widget = urwid.Pile([urwid.Divider(self.g["divider1"]), urwid.Text(self.status_text())]) - return widget + return urwid.AttrMap(widget, "browser_controls") def make_control_widget(self): - return urwid.Pile([urwid.Text(self.g["node"]+" "+self.current_url()), urwid.Divider(self.g["divider1"])]) + return urwid.AttrMap(urwid.Pile([urwid.Text(self.g["node"]+" "+self.current_url()), urwid.Divider(self.g["divider1"])]), "browser_controls") def make_request_failed_widget(self): def back_action(sender): diff --git a/nomadnet/ui/textui/Guide.py b/nomadnet/ui/textui/Guide.py index 5db5222..b95474b 100644 --- a/nomadnet/ui/textui/Guide.py +++ b/nomadnet/ui/textui/Guide.py @@ -421,10 +421,12 @@ By default, Nomad Network starts in low-color mode. It does this for the sake of If you don't already have a Nerd Font installed (see https://www.nerdfonts.com/), I also highly recommend to do so, since it will greatly expand the amount of glyphs, icons and graphics that Nomad Network can use. -Nomad Network expects that you are already connected to some form of Reticulum network. That could be as simple as the default UDP-based demo interface on your local ethernet network, or as advanced as some elaborate hybrid RF and free-space optical laser network. This short guide won't go into any details on that, but you will find other entries in the guide that deal with network setup and configuration. +Nomad Network expects that you are already connected to some form of Reticulum network. That could be as simple as the default UDP-based demo interface on your local ethernet network. This short guide won't go into any details on building, but you will find other entries in the guide that deal with network setup and configuration. At least, if Nomad Network launches, it means that it is connected to a running Reticulum instance, that should in turn be connected to `*something`*, which should get you started. +For more some more information, you can also read the `*Introduction`* section of this guide. + Now go out there and explore. This is still early days. See what you can find and create. >>>>>>>>>>>>>>> diff --git a/nomadnet/ui/textui/MicronParser.py b/nomadnet/ui/textui/MicronParser.py index cd1582b..129547f 100644 --- a/nomadnet/ui/textui/MicronParser.py +++ b/nomadnet/ui/textui/MicronParser.py @@ -5,8 +5,11 @@ from urwid.util import is_mouse_press from urwid.text_layout import calc_coords import re +DEFAULT_FG = "ddd" +DEFAULT_BG = "default" + STYLES = { - "plain": { "fg": "bbb", "bg": "default", "bold": False, "underline": False, "italic": False }, + "plain": { "fg": DEFAULT_FG, "bg": DEFAULT_BG, "bold": False, "underline": False, "italic": False }, "heading1": { "fg": "222", "bg": "bbb", "bold": False, "underline": False, "italic": False }, "heading2": { "fg": "111", "bg": "999", "bold": False, "underline": False, "italic": False }, "heading3": { "fg": "000", "bg": "777", "bold": False, "underline": False, "italic": False }, @@ -24,8 +27,8 @@ def markup_to_attrmaps(markup, url_delegate = None): state = { "literal": False, "depth": 0, - "fg_color": "default", - "bg_color": "default", + "fg_color": DEFAULT_FG, + "bg_color": DEFAULT_BG, "formatting": { "bold": False, "underline": False, @@ -163,7 +166,7 @@ def make_style(state): def mono_color(fg, bg): return "default" def low_color(color): - # TODO: Implement + # TODO: Implement low-color mapper return "default" def high_color(color): if color == "default": @@ -226,20 +229,20 @@ def make_output(state, line, url_delegate): state["fg_color"] = color skip = 3 elif c == "f": - state["fg_color"] = "default" + state["fg_color"] = DEFAULT_FG elif c == "B": if len(line) >= i+4: color = line[i+1:i+4] state["bg_color"] = color skip = 3 elif c == "b": - state["bg_color"] = "default" + state["bg_color"] = DEFAULT_BG elif c == "`": state["formatting"]["bold"] = False state["formatting"]["underline"] = False state["formatting"]["italic"] = False - state["fg_color"] = "default" - state["bg_color"] = "default" + state["fg_color"] = DEFAULT_FG + state["bg_color"] = DEFAULT_BG state["align"] = state["default_align"] elif c == "c": if state["align"] != "center":