Skip to content

Commit 7d1c169

Browse files
committed
more colors and less colors
1 parent 5b74dd0 commit 7d1c169

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

src/meshcore_cli/meshcore_cli.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@
3535
ANSI_END = "\033[0m"
3636
ANSI_GREEN = "\033[0;32m"
3737
ANSI_BLUE = "\033[0;34m"
38-
ANSI_YELLOW = "\033[1;33m"
38+
ANSI_YELLOW = "\033[0;33m"
3939
ANSI_RED = "\033[0;31m"
40-
ANSI_LIGHT_BLUE = "\033[1;34m"
41-
ANSI_LIGHT_GREEN = "\033[1;32m"
40+
ANSI_MAGENTA = "\033[0;35m"
41+
ANSI_CYAN = "\033[0;36m"
42+
ANSI_LIGHT_BLUE = "\033[0;94m"
43+
ANSI_LIGHT_GREEN = "\033[0;92m"
44+
ANSI_LIGHT_YELLOW = "\033[0;93m"
45+
ANSI_LIGHT_GRAY="\033[0;90m"
4246

4347
def escape_ansi(line):
4448
ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]')
@@ -94,12 +98,22 @@ async def process_event_message(mc, ev, json_output, end="\n", above=False):
9498
else:
9599
name = ct["adv_name"]
96100

97-
disp = f"{ANSI_GREEN}{name}"
101+
if ct["type"] == 3 : # room
102+
disp = f"{ANSI_CYAN}"
103+
elif ct["type"] == 2 : # repeater
104+
disp = f"{ANSI_MAGENTA}"
105+
else:
106+
disp = f"{ANSI_GREEN}"
107+
disp = disp + f"{name}"
98108
if 'signature' in data:
99109
sender = mc.get_contact_by_key_prefix(data['signature'])
100-
disp = disp + f"/{sender['adv_name']}"
101-
disp = disp + f"{ANSI_YELLOW}({path_str}){ANSI_END}: "
102-
disp = disp + f"{data['text']}"
110+
disp = disp + f"/{ANSI_GREEN}{sender['adv_name']}"
111+
disp = disp + f" {ANSI_YELLOW}({path_str})"
112+
if data["txt_type"] == 1:
113+
disp = disp + f"{ANSI_LIGHT_GRAY}"
114+
else:
115+
disp = disp + f"{ANSI_END}"
116+
disp = disp + f": {data['text']}"
103117

104118
if not process_event_message.color:
105119
disp = escape_ansi(disp)
@@ -110,8 +124,10 @@ async def process_event_message(mc, ev, json_output, end="\n", above=False):
110124
print(disp)
111125

112126
elif (data['type'] == "CHAN") :
113-
path_str = f"{ANSI_YELLOW}({path_str}){ANSI_END}"
114-
disp = f"{ANSI_GREEN}ch{data['channel_idx']}{path_str}: {data['text']}"
127+
path_str = f" {ANSI_YELLOW}({path_str}){ANSI_END}"
128+
disp = f"{ANSI_GREEN}ch{data['channel_idx']}{path_str}"
129+
disp = disp + f"{ANSI_END}"
130+
disp = disp + f": {data['text']}"
115131

116132
if not process_event_message.color:
117133
disp = escape_ansi(disp)

0 commit comments

Comments
 (0)