继续优化深色模式显示
This commit is contained in:
@@ -17,6 +17,22 @@ _GUI_LEVEL_TO_LOG = {
|
||||
}
|
||||
|
||||
|
||||
def _theme_colors():
|
||||
style = ttk.Style()
|
||||
colors = style.colors
|
||||
return {
|
||||
"bg": colors.bg,
|
||||
"fg": colors.fg,
|
||||
"muted": colors.secondary,
|
||||
"accent": colors.info,
|
||||
"warning": colors.warning,
|
||||
"error": colors.danger,
|
||||
"success": colors.success,
|
||||
"text_bg": colors.inputbg,
|
||||
"text_fg": colors.inputfg,
|
||||
}
|
||||
|
||||
|
||||
class PQLogGUI(ttk.Frame):
|
||||
VALID_LEVELS = {"info", "success", "warning", "error", "debug", "separator", "blank"}
|
||||
|
||||
@@ -53,21 +69,22 @@ class PQLogGUI(ttk.Frame):
|
||||
text_container = ttk.Frame(log_frame)
|
||||
text_container.pack(fill=tk.BOTH, expand=True, padx=6, pady=(0, 6))
|
||||
|
||||
palette = _theme_colors()
|
||||
self.log_text = tk.Text(
|
||||
text_container,
|
||||
height=10,
|
||||
width=50,
|
||||
wrap=tk.WORD,
|
||||
font=("Consolas", 10),
|
||||
bg="#fbfcfe",
|
||||
fg="#1f2937",
|
||||
bg=palette["text_bg"],
|
||||
fg=palette["text_fg"],
|
||||
relief=tk.FLAT,
|
||||
bd=0,
|
||||
padx=10,
|
||||
pady=8,
|
||||
spacing1=2,
|
||||
spacing3=2,
|
||||
insertbackground="#1f2937",
|
||||
insertbackground=palette["text_fg"],
|
||||
)
|
||||
self.log_text.pack(fill=tk.BOTH, expand=True, side=tk.LEFT)
|
||||
|
||||
@@ -114,19 +131,20 @@ class PQLogGUI(ttk.Frame):
|
||||
self._update_summary()
|
||||
|
||||
def _configure_tags(self):
|
||||
self.log_text.tag_configure("timestamp", foreground="#6b7280")
|
||||
self.log_text.tag_configure("level_info", foreground="#2563eb")
|
||||
self.log_text.tag_configure("level_success", foreground="#0f766e")
|
||||
self.log_text.tag_configure("level_warning", foreground="#b45309")
|
||||
self.log_text.tag_configure("level_error", foreground="#b91c1c")
|
||||
palette = _theme_colors()
|
||||
self.log_text.tag_configure("timestamp", foreground=palette["muted"])
|
||||
self.log_text.tag_configure("level_info", foreground=palette["accent"])
|
||||
self.log_text.tag_configure("level_success", foreground=palette["success"])
|
||||
self.log_text.tag_configure("level_warning", foreground=palette["warning"])
|
||||
self.log_text.tag_configure("level_error", foreground=palette["error"])
|
||||
self.log_text.tag_configure("level_debug", foreground="#7c3aed")
|
||||
self.log_text.tag_configure("message", foreground="#1f2937")
|
||||
self.log_text.tag_configure("message_success", foreground="#0f766e")
|
||||
self.log_text.tag_configure("message_warning", foreground="#b45309")
|
||||
self.log_text.tag_configure("message_error", foreground="#991b1b")
|
||||
self.log_text.tag_configure("message", foreground=palette["fg"])
|
||||
self.log_text.tag_configure("message_success", foreground=palette["success"])
|
||||
self.log_text.tag_configure("message_warning", foreground=palette["warning"])
|
||||
self.log_text.tag_configure("message_error", foreground=palette["error"])
|
||||
self.log_text.tag_configure("message_debug", foreground="#6d28d9")
|
||||
self.log_text.tag_configure("separator", foreground="#94a3b8")
|
||||
self.log_text.tag_configure("traceback", foreground="#7f1d1d")
|
||||
self.log_text.tag_configure("separator", foreground=palette["muted"])
|
||||
self.log_text.tag_configure("traceback", foreground=palette["error"])
|
||||
self.log_text.tag_configure("blank", spacing1=4, spacing3=4)
|
||||
|
||||
def _append_message(self, message, level):
|
||||
|
||||
Reference in New Issue
Block a user