The color of the flame is dependent on the metal cation; the anion of the salt has very little direct influence.
[1] Some common examples are: Despite the wide numbers of metal ion donors, they serve to form only a few atomic and molecular species that are useful as light emitters.
[2] In many cases, chlorine donors have to be added in order to achieve sufficiently deep colors, as the desired emitting molecules have to be generated.
Magnesium has less such effect and is therefore more suitable for colored flames; it is more volatile than aluminium and more likely to be present as vapors than as particulates.
The BaCl species tends to be oxidized to less desirable BaO; barium-containing compositions are therefore usually formulated to be oxygen-deficient.