Anki Forums

Change Field Color based on Tag

Hello, I know similar topics have already come up elsewhere but none of them were specifically what I was looking for. I got to the point where I could change the font color of a card based on its tag, but I don’t want all card types and fields to change to that color, just 1 specific field (I have 5 fields).

For example I’m studying a language that has gendered nouns, like French, and I want cards tagged “le” to be red and cards tagged “la” to be blue.

I thought putting the script in the Back Template of my English>French card type would do that, but it just universally colored both sides of every card so that the English side also turned red or blue, but that gives away the “answer” of whether it is a “le” or “la” word, which I want to be part of the quiz.

Also, even though I only added the script to 1 card type (the English>French card type), it changed the color on all card types when I previewed them after, not just the one I added script to - how come?

So how do I change font color on just a specific side of the card (based on tag)? Assume I know next to nothing about coding when answering, thanks!

just for future reference there’s also a thread in the anki subreddit: