Update TUI colors: black-on-blue header, blue border, yellow status bar
This commit is contained in:
parent
33c9b48106
commit
293bd5d550
@ -13,6 +13,7 @@ class HendrikTUI:
|
|||||||
C_STATUS = 6
|
C_STATUS = 6
|
||||||
C_SEP = 7
|
C_SEP = 7
|
||||||
C_ERROR = 8
|
C_ERROR = 8
|
||||||
|
C_INPUT_BORDER = 9
|
||||||
|
|
||||||
def __init__(self, llm_client, tools_definition, TOOLS, TOOL_HANDLERS,
|
def __init__(self, llm_client, tools_definition, TOOLS, TOOL_HANDLERS,
|
||||||
build_system_prompt, agent_max_iterations):
|
build_system_prompt, agent_max_iterations):
|
||||||
@ -70,14 +71,15 @@ class HendrikTUI:
|
|||||||
# ---- colors -----------------------------------------------------------
|
# ---- colors -----------------------------------------------------------
|
||||||
|
|
||||||
def _init_colors(self):
|
def _init_colors(self):
|
||||||
curses.init_pair(self.C_HEADER, curses.COLOR_WHITE, curses.COLOR_BLUE)
|
curses.init_pair(self.C_HEADER, curses.COLOR_BLACK, curses.COLOR_BLUE)
|
||||||
curses.init_pair(self.C_USER, curses.COLOR_CYAN, -1)
|
curses.init_pair(self.C_USER, curses.COLOR_CYAN, -1)
|
||||||
curses.init_pair(self.C_AI, curses.COLOR_GREEN, -1)
|
curses.init_pair(self.C_AI, curses.COLOR_GREEN, -1)
|
||||||
curses.init_pair(self.C_SYSTEM, curses.COLOR_YELLOW, -1)
|
curses.init_pair(self.C_SYSTEM, curses.COLOR_YELLOW, -1)
|
||||||
curses.init_pair(self.C_INPUT, curses.COLOR_WHITE, -1)
|
curses.init_pair(self.C_INPUT, curses.COLOR_WHITE, -1)
|
||||||
curses.init_pair(self.C_STATUS, curses.COLOR_BLACK, curses.COLOR_WHITE)
|
curses.init_pair(self.C_STATUS, curses.COLOR_BLACK, curses.COLOR_YELLOW)
|
||||||
curses.init_pair(self.C_SEP, curses.COLOR_MAGENTA, -1)
|
curses.init_pair(self.C_SEP, curses.COLOR_MAGENTA, -1)
|
||||||
curses.init_pair(self.C_ERROR, curses.COLOR_RED, -1)
|
curses.init_pair(self.C_ERROR, curses.COLOR_RED, -1)
|
||||||
|
curses.init_pair(self.C_INPUT_BORDER, curses.COLOR_BLUE, -1)
|
||||||
|
|
||||||
# ---- main draw --------------------------------------------------------
|
# ---- main draw --------------------------------------------------------
|
||||||
|
|
||||||
@ -153,13 +155,14 @@ class HendrikTUI:
|
|||||||
|
|
||||||
def _draw_input(self, stdscr):
|
def _draw_input(self, stdscr):
|
||||||
iy = self.h - 8
|
iy = self.h - 8
|
||||||
|
border_attr = curses.color_pair(self.C_INPUT_BORDER) | curses.A_BOLD
|
||||||
|
|
||||||
for off, text in [
|
for off, text in [
|
||||||
(0, "\u250c" + "\u2500" * (self.w - 2) + "\u2510"),
|
(0, "\u250c" + "\u2500" * (self.w - 2) + "\u2510"),
|
||||||
(7, "\u2514" + "\u2500" * (self.w - 2) + "\u2518"),
|
(7, "\u2514" + "\u2500" * (self.w - 2) + "\u2518"),
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
stdscr.addstr(iy + off, 0, text[:self.w])
|
stdscr.addstr(iy + off, 0, text[:self.w], border_attr)
|
||||||
except curses.error:
|
except curses.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -170,6 +173,7 @@ class HendrikTUI:
|
|||||||
show = max(0, min(self.input_line - 3, total - 6))
|
show = max(0, min(self.input_line - 3, total - 6))
|
||||||
|
|
||||||
cursor_yx = None
|
cursor_yx = None
|
||||||
|
text_attr = curses.color_pair(self.C_INPUT)
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
idx = show + i
|
idx = show + i
|
||||||
y = iy + 1 + i
|
y = iy + 1 + i
|
||||||
@ -177,14 +181,29 @@ class HendrikTUI:
|
|||||||
max_text = self.w - 6
|
max_text = self.w - 6
|
||||||
if len(line) > max_text:
|
if len(line) > max_text:
|
||||||
line = line[:max_text]
|
line = line[:max_text]
|
||||||
if idx < total:
|
|
||||||
fmt = "\u2502 > " + line + " " * (max_text + 1 - len(line)) + "\u2502"
|
|
||||||
else:
|
|
||||||
fmt = "\u2502 " + " " * (self.w - 5) + "\u2502"
|
|
||||||
try:
|
try:
|
||||||
stdscr.addstr(y, 0, fmt, curses.color_pair(self.C_INPUT))
|
stdscr.addstr(y, 0, "\u2502 ", border_attr)
|
||||||
except curses.error:
|
except curses.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if idx < total:
|
||||||
|
content = "> " + line + " " * (self.w - 4 - 2 - len(line))
|
||||||
|
try:
|
||||||
|
stdscr.addstr(y, 2, content, text_attr)
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
stdscr.addstr(y, 2, " " * (self.w - 4), border_attr)
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
stdscr.addstr(y, self.w - 2, " \u2502", border_attr)
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
if idx == self.input_line and not self.processing:
|
if idx == self.input_line and not self.processing:
|
||||||
cursor_yx = (y, 4 + min(self.input_col, max_text))
|
cursor_yx = (y, 4 + min(self.input_col, max_text))
|
||||||
|
|
||||||
@ -202,7 +221,7 @@ class HendrikTUI:
|
|||||||
if len(ws) > max_ws:
|
if len(ws) > max_ws:
|
||||||
ws = ".." + ws[-(max_ws - 2):]
|
ws = ".." + ws[-(max_ws - 2):]
|
||||||
status = f" {ws} \u2502{mode}\u2502{hints}"
|
status = f" {ws} \u2502{mode}\u2502{hints}"
|
||||||
attr = curses.color_pair(self.C_STATUS)
|
attr = curses.color_pair(self.C_STATUS) | curses.A_BOLD
|
||||||
stdscr.addstr(y, 0, status[:self.w], attr)
|
stdscr.addstr(y, 0, status[:self.w], attr)
|
||||||
|
|
||||||
# ---- input handling ---------------------------------------------------
|
# ---- input handling ---------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user