Skip to content

Commit 27f9a01

Browse files
committed
Fix dialog coloring
1 parent 1d7e440 commit 27f9a01

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

rummage/lib/gui/dialogs/rummage_dialog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ def update_tab_page_colors(self):
478478
if util.platform() == "macos" and not util.MAC_OLD:
479479
color = Color.from_wxbgr(bg.GetRGB())
480480
factor = util.MAC_LIGHT if color.luminance() > 0.5 else util.MAC_DARK
481-
color.set('lab-d65.lightness', lambda l, f=factor: l + (100.0 * f) - 100.0)
481+
color.set('alpha', 1.0).mix(
482+
'black' if color.luminance() > 0.5 else 'white', factor, space='srgb', in_place=True
483+
).set('alpha', 1.0)
482484
bg.SetRGB(color.to_wxbgr())
483485
page.SetBackgroundColour(bg)
484486
if x == 0:

rummage/lib/gui/dialogs/settings_dialog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def update_tab_page_colors(self):
200200
if util.platform() == "macos" and not util.MAC_OLD:
201201
color = Color.from_wxbgr(bg.GetRGB())
202202
factor = util.MAC_LIGHT if color.luminance() > 0.5 else util.MAC_DARK
203-
color.set('lab-d65.lightness', lambda l, f=factor: l + (100.0 * f) - 100.0)
203+
color.set('alpha', 1.0).mix(
204+
'black' if color.luminance() > 0.5 else 'white', factor, space='srgb', in_place=True
205+
).set('alpha', 1.0)
204206
bg.SetRGB(color.to_wxbgr())
205207
page.SetBackgroundColour(bg)
206208
if x == 0 and util.platform() != "linux":

rummage/lib/gui/util/__init__.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,8 @@
2222

2323
# High Sierra and below
2424
MAC_OLD = _MAC_VER < (10, 14)
25-
MAC_TAHOE = _MAC_VER >= (26, 0)
26-
27-
if MAC_TAHOE:
28-
MAC_LIGHT = 0.98
29-
MAC_DARK = 1.09
30-
elif WX_420:
31-
MAC_LIGHT = 1.023
32-
MAC_DARK = 1.043
33-
else:
34-
MAC_LIGHT = 0.99
35-
MAC_DARK = 1.085
36-
25+
MAC_LIGHT = 0.025
26+
MAC_DARK = 0.075
3727

3828
def mac_ver():
3929
"""Get macOS version."""

0 commit comments

Comments
 (0)