-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b11601
commit 528c582
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# themes.py | ||
|
||
THEMES = { | ||
"light": { | ||
"bg": "white", | ||
"fg": "black", | ||
"button_bg": "#eeeeee", # Light gray | ||
"button_fg": "black", | ||
}, | ||
"dark": { | ||
"bg": "#2d2d2d", # Dark gray | ||
"fg": "white", | ||
"button_bg": "#555555", # Darker gray | ||
"button_fg": "white", | ||
}, | ||
} | ||
|
||
def apply_theme(root, theme): | ||
selected_theme = THEMES.get(theme, THEMES["light"]) # Default to light theme if theme not found | ||
root.configure(bg=selected_theme["bg"]) | ||
|
||
for widget in root.winfo_children(): | ||
apply_widget_theme(widget, selected_theme) | ||
|
||
|
||
def apply_widget_theme(widget, theme): | ||
if widget.winfo_class() == "Button": | ||
widget.configure(bg=theme["button_bg"], fg=theme["button_fg"]) | ||
else: | ||
widget.configure(bg=theme["bg"], fg=theme["fg"]) |