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.
This commit is contained in:
Damien Elmes 2022-04-13 13:52:19 +10:00
parent 51a0641bba
commit 29c48a60e0

View file

@ -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,
)