Hi! In my Anki collection, I use particular colors (and sometimes other font features, like underlining) to mean particular things – for instance, red for emphasis, gray for de-emphasis, blue for “structure” (numbering etc), purple for “marking instructions” (e.g., specifying a margin of error for quantitative questions), etc. I’d like to be able to change the color associated with a particular function without having to change it manually in every card type. So, I’m looking for a way to say something in the note type CSS like “‘emphasis’ = red”, and then in the template for individual card types, say something like “font color=emphasis” rather than “font color=red”. That way I can change the color of all the emphasized text in the note type just by making one change in the CSS.
I spent a while Googling this without finding a clear answer (maybe I just don’t know the right search terms to describe what I’m trying to do). But I did eventually find something that seems to work, by trial and error. In the note type CSS, I add something like:
#marking {color: #af52de;}
And then in the card templates, I write:
<font id=marking> ... </font>
…which gives me text with the color #af52de
. But since I arrived at this by trial and error, I’m guessing it’s not the preferred/optimal solution, and would rather find that solution before I invest a lot of time in updating all my templates.
So, if anyone can tell me the “right way” to do this, that would be much appreciated!