Toggling Night Mode appears to change QT/GTK theme

Hello there,

I’m using Anki 2.1.48 from anki-bin on the AUR. I’m having a strange issue with night mode and my GTK theme. My GTK theme is Equilux.

At first, my GTK theme wasn’t applied to any parts of the interface. I looked up the issue, and installed qt5ct and set my theme to gtk2 through there. The preview shows my GTK theme applied basically perfectly. I also set $QT_QPA_PLATFORMTHEME to gtk2 in /etc/environment. The rest of my QT apps, like QPDFView, work with the GTK theme applied.

Then, I had my theme working, albeit with the issue that everything was dark / the review interface was black-on-white (a light mode). I went into Preferences, and toggled Night Mode to on. However, upon reloading, my GTK theme seems to be disabled as a QT theme, and the interface elements are different - using a blue highlight and a different font, for example. With night mode, the review interface is white-on-dark, as expected, but my GTK / QT theme doesn’t seem to be properly applied.

Here are some screenshots of the issue.
Below, with night mode enabled, and with the ‘wrong’ theme. Interface elements are light on dark as desired.

With night mode off (ignore that the Deck and New are white, I went and edited the CSS in /usr/lib/python3.9/site-packages/aqt/data/web/css/). Interface elements are dark on dark, but correct theme applied.

Please let me know how I can fix this issue. I can live with the differing interface elements, but having a cohesive experience with my Equilux theme would be nice!

Anki’s night mode forces a particular theme, since not all themes will work correctly with dark colors. The interface does not expose a way to override this, but you might be able to do so with an add-on.

Alright - sounds good. Would you happen to know of any addons that still do this by any chance? I’ve looked at the night mode addon, but that’s been discontinued.

Regardless, thank you for the work you do! I’ll keep searching on my own then.

Something like this in an add-on might do it:

print(QStyleFactory.keys())
mw.app.setStyle(QStyleFactory.create("fusion"))

It will print the available keys in the console; replace “fusion” with the style you want.

Thank you so much - this solved my issue!