Instead of substituting {{c1::math::hint}} with just [hint] on the front and math on the back, it can be replaced with something like \class{cloze}{[hint]} and \class{cloze}{math} (or preferably a separate class like math-cloze whose default style doesn’t make text bold).
Doing it manually works if there is only one cloze but if there are multiple clozes, they would all change color even when it’s not their card.
Is \class valid in all contexts that plain text would be? The reason I avoided colors in the past was a worry that it might lead to broken rendering in some situations.
Oh I see what you mean. Yeah afaik, it should work in all contexts. At least from personally playing around with it, I couldn’t find a place where it didn’t work properly. But of-course more people testing it is more likely to find any potential bugs it causes.