It seems that Anki ignores the org.freedesktop.appearance.color-scheme key from the settings portal. When the system-wide dark style preference is toggled to dark (for example automatically at sunset), Anki stays on the light theme.
Unless I’m mistaken, there is a KDE implementation, so it would work for KDE too: in the KDE gitlab, enter in “plasma” group, then “KDE Portal for XDG Desktop” subgroup, and search for “Implement freedesktop colorscheme preference” in the merge requests (sorry, but I’m not allowed to post a link).