I have “Paste without shift key strips formatting” unchecked.
During card editing, when I paste from Intellij Idea (with colored text) to Anki, all colors are stripped, yet formatting is retained.
This only happens in the Dark Mode of Anki. If I switch to Light Mode, both the colors and formatting are retained.
If I create the card in Light Mode and view the card in Dark Mode, it also works fine.