Honor night mode when switching between cards in card info

This commit is contained in:
Damien Elmes 2024-05-22 17:07:01 +07:00
parent 4a55f69e48
commit c8f8a9cd2f

View file

@ -65,11 +65,18 @@ class CardInfoDialog(QDialog):
self.setLayout(layout) self.setLayout(layout)
def update_card(self, card_id: CardId | None) -> None: def update_card(self, card_id: CardId | None) -> None:
from aqt.theme import theme_manager
try: try:
self.mw.col.get_card(card_id) self.mw.col.get_card(card_id)
except NotFoundError: except NotFoundError:
card_id = None card_id = None
self.web.eval(f"window.location.href = '/card-info/{card_id}';")
if theme_manager.night_mode:
extra = "#night"
else:
extra = ""
self.web.eval(f"window.location.href = '/card-info/{card_id}{extra}';")
def reject(self) -> None: def reject(self) -> None:
if self._on_close: if self._on_close: