How does colored fire work?

No.11083866 ViewReplyOriginalReport
If you put borax or potassium chloride in a flame, you get green and purple, but how?
Apparently blackbody radiation but how? Doesn't that just say *a* temperature -> *a* certain mix of colors (and not necessarily green like borax)?