From 29c48a60e0e25d3bba4dfbf791c5259e20c717ce Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 13 Apr 2022 13:52:19 +1000 Subject: [PATCH] Fix illegible calendar buttons in dark mode on Mac/Linux https://forums.ankiweb.net/t/macos-apple-silicon-2-1-50-dark-mode-statistics-heatmap-buttons-dont-have-icons/18951 This button code is in need of a cleanup. --- qt/aqt/webview.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 87f986507..7892853a4 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -421,18 +421,22 @@ button:focus {{ outline: 5px auto {color_hl}; }}""" elif is_mac: family = "Helvetica" font = f'font-size:15px;font-family:"{family}";' - button_style = """ -button { -webkit-appearance: none; background: #fff; border: 1px solid #ccc; + color = "" + if not theme_manager.night_mode: + color = "background: #fff; border: 1px solid #ccc;" + button_style = ( + """ +button { -webkit-appearance: none; %s border-radius:5px; font-family: Helvetica }""" + % color + ) else: family = self.font().family() color_hl_txt = palette.color(QPalette.ColorRole.HighlightedText).name() - color_btn = palette.color(QPalette.ColorRole.Button).name() font = f'font-size:14px;font-family:"{family}", sans-serif;' button_style = """ /* Buttons */ button{{ - background-color: {color_btn}; font-family:"{family}", sans-serif; }} button:focus{{ border-color: {color_hl} }} button:active, button:active:hover {{ background-color: {color_hl}; color: {color_hl_txt};}} @@ -443,7 +447,6 @@ div[contenteditable="true"]:focus {{ border-color: {color_hl}; }}""".format( family=family, - color_btn=color_btn, color_hl=color_hl, color_hl_txt=color_hl_txt, )