From b41ac7ae1de2b437017f76a2c60bb6d607873b15 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 3 Aug 2022 11:34:27 -0500 Subject: [PATCH] Add light mode in addition to night mode This utilizes Anki's theme_manager to determine if the default light version of a card should be used in the Editor Live Preview or if the night mode version should be used. --- src/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index eb63031..147ae6e 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -75,7 +75,10 @@ class EditorPreview(object): c = note.ephemeral_card() a = mw.prepare_card_text_for_display(c.answer()) a = gui_hooks.card_will_show(a, c, "clayoutAnswer") - bodyclass = theme_manager.body_classes_for_card_ord(c.ord, mw.pm.night_mode()) + if theme_manager.night_mode: + bodyclass = theme_manager.body_classes_for_card_ord(c.ord, mw.pm.night_mode()) + else: + bodyclass = theme_manager.body_classes_for_card_ord(c.ord) return f"_showAnswer({json.dumps(a)},'{bodyclass}');"