Skip to content

Commit 045f4ac

Browse files
committed
Fix macOS bud that causes tooltip to have white text on a white background in dark mode
1 parent a30dcc3 commit 045f4ac

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

engine/gui/tooltip.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ def _show(self) -> None:
6666
x = self.widget.winfo_rootx() + 20
6767
y = self.widget.winfo_rooty() + self.widget.winfo_height() + 5
6868

69-
self.tip_window = tk.Toplevel(self.widget)
69+
self.tip_window = tk.Toplevel(self.widget, class_="Tooltip")
7070
self.tip_window.wm_overrideredirect(True)
7171
self.tip_window.wm_geometry(f"+{x}+{y}")
7272

7373
label = tk.Label(
7474
self.tip_window,
7575
text=self.text,
7676
justify="left",
77-
background="#f0f0f0",
7877
relief="solid",
7978
borderwidth=1,
8079
padx=6,

engine/tcl/theme.tcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ dict set ui_color selected_background #0078D7
99
dict set ui_color text #333333
1010
dict set ui_color selected_foreground #FFFFFF
1111

12+
if {[tk windowingsystem] eq "aqua"} {
13+
dict set ui_color tooltip_background systemWindowBackgroundColor
14+
dict set ui_color tooltip_foreground systemTextColor
15+
} else {
16+
dict set ui_color tooltip_background #F0F0F0
17+
dict set ui_color tooltip_foreground [dict get $ui_color text]
18+
}
19+
1220
option add *selectedBackground [dict get $ui_color selected_background]
1321
option add *selectedForeground [dict get $ui_color selected_foreground]
1422

@@ -19,3 +27,6 @@ option add *Entry.Font [dict get $font default]
1927
option add *LabelFrame.Font [dict get $font small]
2028

2129
option add *LabelFrame.relief solid
30+
31+
option add *Tooltip*background [dict get $ui_color tooltip_background]
32+
option add *Tooltip*foreground [dict get $ui_color tooltip_foreground]

0 commit comments

Comments
 (0)