commit 23

This commit is contained in:
2025-07-29 14:26:17 +02:00
parent 80940f6119
commit 592b68eb88
3 changed files with 10 additions and 8 deletions

View File

@@ -167,9 +167,9 @@ class CustomFileDialog(tk.Toplevel):
def create_styles(self):
style = ttk.Style(self)
base_bg = self.cget('background')
is_dark = sum(self.winfo_rgb(base_bg)) / 3 < 32768
self.is_dark = sum(self.winfo_rgb(base_bg)) / 3 < 32768
if is_dark:
if self.is_dark:
self.selection_color = "#4a6984" # Darker blue for selection
self.icon_bg_color = "#3c3c3c" # Lighter background for content
self.accent_color = "#2a2a2a" # Darker accent for the bottom
@@ -219,7 +219,7 @@ class CustomFileDialog(tk.Toplevel):
('selected', self.selection_color)])
style.configure("Item.TLabel", background=self.icon_bg_color)
style.map('Item.TLabel', background=[('selected', self.selection_color)], foreground=[
('selected', "black" if not is_dark else "white")])
('selected', "black" if not self.is_dark else "white")])
style.configure("Icon.TLabel", background=self.icon_bg_color)
style.map('Icon.TLabel', background=[
('selected', self.selection_color)])
@@ -229,7 +229,7 @@ class CustomFileDialog(tk.Toplevel):
style.configure("Treeview", rowheight=28,
background=self.icon_bg_color, fieldbackground=self.icon_bg_color, borderwidth=0)
style.map("Treeview", background=[('selected', self.selection_color)], foreground=[
('selected', "black" if not is_dark else "white")])
('selected', "black" if not self.is_dark else "white")])
style.configure("TButton.Borderless.Round", anchor="w")
@@ -295,7 +295,8 @@ class CustomFileDialog(tk.Toplevel):
Tooltip(self.hidden_files_button, "Versteckte Dateien anzeigen")
# Horizontal separator
ttk.Separator(main_frame, orient='horizontal').grid(
separator_color = "#000000" if self.is_dark else "#d9d9d9"
tk.Frame(main_frame, height=1, bg=separator_color).grid(
row=1, column=0, sticky="ew")
# Paned window for sidebar and content
@@ -332,7 +333,8 @@ class CustomFileDialog(tk.Toplevel):
compound="left", command=lambda p=config['path']: self.navigate_to(p), style="Dark.TButton.Borderless")
btn.pack(fill="x", pady=1)
ttk.Separator(sidebar_buttons_frame, orient='horizontal').pack(fill='x', pady=10, padx=20)
ttk.Separator(sidebar_buttons_frame, orient='horizontal').pack(
fill='x', pady=10, padx=20)
storage_frame = ttk.Frame(sidebar_frame, style="Sidebar.TFrame")
storage_frame.grid(row=1, column=0, sticky="ew", padx=10)
@@ -372,7 +374,7 @@ class CustomFileDialog(tk.Toplevel):
command=self.on_cancel).grid(row=1, column=0, padx=10)
self.filter_combobox = ttk.Combobox(
bottom_controls_frame, values=[ft[0] for ft in self.filetypes], state="readonly", width=20)
bottom_controls_frame, values=[ft[0] for ft in self.filetypes], state="readonly")
self.filter_combobox.grid(
row=1, column=1, sticky="w", padx=10, pady=(5, 10))
self.filter_combobox.bind(

View File

@@ -58,7 +58,7 @@ if __name__ == "__main__":
style = ttk.Style(root)
root.tk.call('source', f"{theme_path}/water.tcl")
try:
root.tk.call('set_theme', 'dark')
root.tk.call('set_theme', 'light')
except tk.TclError:
pass
root.mainloop()