5
5
from settings import settings_menu
6
6
from message_handlers .tx_handler import send_message , send_traceroute
7
7
import ui .dialog
8
-
8
+ from ui . colors import setup_colors
9
9
10
10
def add_notification (channel_number ):
11
11
handle_notification (channel_number , add = True )
@@ -36,8 +36,7 @@ def draw_debug(value):
36
36
function_win .refresh ()
37
37
38
38
def draw_splash (stdscr ):
39
- curses .start_color ()
40
- curses .init_pair (1 , curses .COLOR_GREEN , curses .COLOR_BLACK ) # Green text on black background
39
+ setup_colors ()
41
40
curses .curs_set (0 )
42
41
43
42
stdscr .clear ()
@@ -50,9 +49,9 @@ def draw_splash(stdscr):
50
49
start_x = width // 2 - len (message_1 ) // 2
51
50
start_x2 = width // 2 - len (message_4 ) // 2
52
51
start_y = height // 2 - 1
53
- stdscr .addstr (start_y , start_x , message_1 , curses .color_pair (1 ) | curses .A_BOLD )
54
- stdscr .addstr (start_y + 1 , start_x - 1 , message_2 , curses .color_pair (1 ) | curses .A_BOLD )
55
- stdscr .addstr (start_y + 2 , start_x - 2 , message_3 , curses .color_pair (1 ) | curses .A_BOLD )
52
+ stdscr .addstr (start_y , start_x , message_1 , curses .color_pair (2 ) | curses .A_BOLD )
53
+ stdscr .addstr (start_y + 1 , start_x - 1 , message_2 , curses .color_pair (2 ) | curses .A_BOLD )
54
+ stdscr .addstr (start_y + 2 , start_x - 2 , message_3 , curses .color_pair (2 ) | curses .A_BOLD )
56
55
stdscr .addstr (start_y + 4 , start_x2 , message_4 )
57
56
stdscr .box ()
58
57
stdscr .refresh ()
@@ -78,10 +77,10 @@ def draw_channel_list():
78
77
truncated_channel = channel [:win_width - 5 ] + '-' if len (channel ) > win_width - 5 else channel
79
78
if i < win_height - 2 : # Check if there is enough space in the window
80
79
if start_index + i == globals .selected_channel and globals .current_window == 0 :
81
- channel_win .addstr (i + 1 , 1 , truncated_channel + notification , curses .color_pair (3 ) )
80
+ channel_win .addstr (i + 1 , 1 , truncated_channel + notification , curses .color_pair (1 ) | curses . A_REVERSE )
82
81
remove_notification (globals .selected_channel )
83
82
else :
84
- channel_win .addstr (i + 1 , 1 , truncated_channel + notification , curses .color_pair (4 ))
83
+ channel_win .addstr (i + 1 , 1 , truncated_channel + notification , curses .color_pair (1 ))
85
84
channel_win .box ()
86
85
channel_win .refresh ()
87
86
@@ -133,9 +132,9 @@ def draw_messages_window():
133
132
for line in wrapped_lines :
134
133
# Highlight the row if it's the selected message
135
134
if index == globals .selected_message and globals .current_window == 1 :
136
- color = curses .color_pair ( 3 ) # Highlighted row color
135
+ color = curses .A_REVERSE # Highlighted row color
137
136
else :
138
- color = curses .color_pair (1 ) if prefix .startswith (globals .sent_message_prefix ) else curses .color_pair (2 )
137
+ color = curses .color_pair (4 ) if prefix .startswith (globals .sent_message_prefix ) else curses .color_pair (3 )
139
138
messages_win .addstr (row , 1 , line , color )
140
139
row += 1
141
140
@@ -153,9 +152,9 @@ def draw_node_list():
153
152
for i , node in enumerate (globals .node_list [start_index :], start = 1 ):
154
153
if i < win_height - 1 : # Check if there is enough space in the window
155
154
if globals .selected_node + 1 == start_index + i and globals .current_window == 2 :
156
- nodes_win .addstr (i , 1 , get_name_from_number (node , "long" ), curses .color_pair (3 ) )
155
+ nodes_win .addstr (i , 1 , get_name_from_number (node , "long" ), curses .color_pair (1 ) | curses . A_REVERSE )
157
156
else :
158
- nodes_win .addstr (i , 1 , get_name_from_number (node , "long" ), curses .color_pair (4 ))
157
+ nodes_win .addstr (i , 1 , get_name_from_number (node , "long" ), curses .color_pair (1 ))
159
158
160
159
nodes_win .box ()
161
160
nodes_win .refresh ()
@@ -246,14 +245,6 @@ def main_ui(stdscr):
246
245
stdscr .keypad (True )
247
246
get_channels ()
248
247
249
- # Initialize colors
250
- curses .start_color ()
251
- curses .init_pair (1 , curses .COLOR_CYAN , curses .COLOR_BLACK )
252
- curses .init_pair (2 , curses .COLOR_YELLOW , curses .COLOR_BLACK )
253
- curses .init_pair (3 , curses .COLOR_BLACK , curses .COLOR_WHITE )
254
- curses .init_pair (4 , curses .COLOR_WHITE , curses .COLOR_BLACK )
255
- curses .init_pair (5 , curses .COLOR_RED , curses .COLOR_BLACK )
256
-
257
248
# Calculate window max dimensions
258
249
height , width = stdscr .getmaxyx ()
259
250
0 commit comments