Colour due to F-centre is same as that produced in a flame test, why?
Why are the colours the same as the metal. Basically, the anion doesn't affect the colour, but the cation does. And since the cation is just the metal missing an electron or several, of course, they exhibit similar behaviour!

Colours we see are determined by the transitions made by electrons "falling" from a high energy state to a lower energy state, and in the process releasing one or some photons with a frequency in what we call the visible spectrum.

When an F-centre is formed in the described conditions, we have effectively extended the lattice with additional cations the same as those already present. But rather than additional anions that match as well, free electrons take the place in the lattice that would be occupied by one.

Now the anion already has its orbitals filled - there is nowhere for an associated electron to move into when excited, nor somewhere for other electrons to enter when relaxed, and thus there is no way for them to release energy as photons that we sense as light. So the anion doesn't affect the colour.

However the cation has empty orbitals when neutral, let alone when positively charged (i.e. has an electron(s) removed). This means any excitation or relaxation will involve these orbitals.

The result is that the electron movements in the  F-centre lattice are the same as those that would occur in the ionisation of the metal which  the cation is derived from, and hence the colours are also the same.

Why those specific colours for the respective compounds? That would be a completely different question, and probably found in a quantum mechanics discussion rather than a chemistry area.