Skip to content

Commit

Permalink
Improve contrast in light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
supercam19 committed Mar 24, 2024
1 parent 2fad90f commit 4f93cf5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Full Release v1.1.0 (???)

### Changes
- Made the title clickable to open the GitHub page
- Improve UI contrast in light mode

### Fixes
- Fixed program crashing on load if Windows changed the name of a monitor
Expand Down
4 changes: 2 additions & 2 deletions Tooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def __init__(self, widget, text, follow_mouse=True):
# Leaves only the label and removes the topbar of the window
self.wm_overrideredirect(True)
self.wm_geometry(f'+{x}+{y}')
self.wm_attributes("-transparentcolor", "#bdbdbd") if ctk.get_appearance_mode() == "Light" else self.wm_attributes("-transparentcolor", "#555555")
self.wm_attributes("-transparentcolor", "#e3e3e3") if ctk.get_appearance_mode() == "Light" else self.wm_attributes("-transparentcolor", "#555555")
self.configure(bg=("#bdbdbd", "#555555"))
self.label = ctk.CTkLabel(self, text=self.text, corner_radius=10, bg_color=("#bdbdbd", '#555555'), fg_color=("#bebebe", '#545454'),
self.label = ctk.CTkLabel(self, text=self.text, corner_radius=10, bg_color=("#e3e3e3", '#555555'), fg_color=("#e4e4e4", '#545454'),
width=1)
self.label.pack()

Expand Down
8 changes: 4 additions & 4 deletions gmutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ def get_monitor_id_from_name(name):
def check_files():
os.chdir(".")
if not os.path.isfile("displayz.exe"):
# print("displayz.exe not found, downloading...")
url = "https://github.com/michidk/displayz/releases/download/0.1.0/displayz.exe"
try:
r = requests.get(url, allow_redirects=True)

with open("displayz.exe", "wb") as f:
f.write(r.content)
# print("displayz.exe downloaded")
except:
pass
except Exception as e:
popup("Error", f"Could not download required file displayz.exe. Submit an issue to the GitHub if you believe this is a bug:\n\n {e}")
exit(0)
if not os.path.isfile("settings.json"):
with open("settings.json", "w") as f:
f.write('{"default_monitor": 0, "games": []}')
Expand All @@ -56,7 +56,7 @@ def check_files():

with open("icon.ico", "wb") as f:
f.write(r.content)
except:
except Exception as e:
pass


Expand Down
22 changes: 11 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,41 +41,41 @@ def __init__(self):
self.geometry('500x400+%d+%d' % (x, y + 30))
self.minsize(450, 360)

self.title_frame = ctk.CTkFrame(self, fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"))
self.title_frame = ctk.CTkFrame(self, fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"))
self.title_frame.pack(side='top', fill='x')

self.reveal_monitors = ctk.CTkButton(self.title_frame, text="?", command=self.reveal_monitors,
fg_color=("#d6d6d6", "#272727"),
hover_color=("#e0e0e0", "#2b2b2b"), width=20, font=("Arial", 20), corner_radius=8)
fg_color=("#ffffff", "#272727"), text_color=("black", "white"),
hover_color=("#f6f6f6", "#2b2b2b"), width=20, font=("Arial", 20), corner_radius=8)
self.reveal_monitors.pack(padx=10, pady=5, side='left')
self.reveal_monitors_tt = Tooltip(self.reveal_monitors, "Show monitor names")

self.add_game = ctk.CTkButton(self.title_frame, text="+", command=lambda: add_game(self), hover_color=("#e0e0e0", "#2b2b2b"),
fg_color=("#d6d6d6", "#272727"), width=20, font=("Arial", 20), corner_radius=8, text_color=("black", "white"))
self.add_game = ctk.CTkButton(self.title_frame, text="+", command=lambda: add_game(self), hover_color=("#f6f6f6", "#2b2b2b"),
fg_color=("#ffffff", "#272727"), width=20, font=("Arial", 20), corner_radius=8, text_color=("black", "white"))
self.add_game.pack(padx=10, pady=5, side='right')
self.add_game_tt = Tooltip(self.add_game, "Add game")

self.title_button = ctk.CTkButton(self.title_frame, text="GameMonitor", font=("Arial", 20, "bold"), command=lambda: webbrowser.open("https://github.com/supercam19/GameMonitor"),
fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"), hover=False, width=0)
fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"), hover=False, width=0, text_color=("black", "white"))
self.title_button.pack(pady=10)
self.title_button.bind("<Enter>", self.title_hovered)
self.title_button.bind("<Leave>", self.title_leave)

self.games_list_frame = ctk.CTkScrollableFrame(self, width=500, fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"))
self.games_list_frame = ctk.CTkScrollableFrame(self, width=500, fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"))
self.games_list_frame.pack(side="top", fill="both", expand=True)

self.options_frame = ctk.CTkFrame(self, fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"))
self.options_frame = ctk.CTkFrame(self, fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"))
self.options_frame.pack(side='top', fill='x')

self.enable_startup_fr = ctk.CTkFrame(self.options_frame, fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"))
self.enable_startup_fr = ctk.CTkFrame(self.options_frame, fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"))
self.enable_startup_fr.pack(fill='x')
self.enable_startup_lbl = ctk.CTkLabel(self.enable_startup_fr, text="Enable on startup", font=("Arial", 14))
self.enable_startup_lbl.pack(side='left', padx=10)
self.enable_startup_sw = ctk.CTkSwitch(self.enable_startup_fr, command=self.toggle_startup, text="", width=0)
self.enable_startup_sw.pack(side='right', padx=10)
self.enable_startup_sw.select() if json_read_safe_default("settings.json", "startup", 0) else self.enable_startup_sw.deselect()

self.default_monitor_fr = ctk.CTkFrame(self.options_frame, fg_color=("#cfcfcf", "#272727"), bg_color=("#cfcfcf", "#272727"))
self.default_monitor_fr = ctk.CTkFrame(self.options_frame, fg_color=("#ffffff", "#272727"), bg_color=("#ffffff", "#272727"))
self.default_monitor_fr.pack(fill='x')
self.default_monitor_lbl = ctk.CTkLabel(self.default_monitor_fr, text="Default Monitor", font=("Arial", 14))
self.default_monitor_lbl.pack(side='left', padx=10)
Expand Down Expand Up @@ -134,7 +134,7 @@ def update_monitor(self, monitor):
self.window.flag_data_refresh = True

def add_to_window(self, window):
colour = ("#d6d6d6", "#333333") if window.games_list_len % 2 == 0 else ("#e0e0e0", "#2b2b2b")
colour = ("#ececec", "#333333") if window.games_list_len % 2 == 0 else ("#f6f6f6", "#2b2b2b")
window.games_list_len += 1
self.game_fr = ctk.CTkFrame(window.games_list_frame, bg_color=colour, fg_color=colour)
self.game_fr.pack(fill="x")
Expand Down

0 comments on commit 4f93cf5

Please sign in to comment.