While reading my NCERT chemistry book (Page number 300), I came across a table that mentions colors emitted by alkali metals and corresponding wavelengths. It mentions that Potassium emits a violet color (as far as I know it's more close to lilac) but the corresponding wavelength written is 766.5 nm (I mean this is closer to the red region), which does not even lie in visible spectrum range. Does that mean that infrared rays are emitted and the book suggests that or is it wrong to say so?
The NCERT textbook is partially wrong for elements after sodium. The flame colors and wavelengths do not match. Keep in mind that for alkali metals, the Bunsen burner flame shows multiple wavelengths for potassium, rubidium and cesium. It is very easy to excite their outermost electron in such a low temperature flame to higher energy levels. My point is that the table should mention multiple lines for K, Rb and Cs.
What you textbook is showing is showing the wavelength of the strongest intensity for all elements except Cs.
The strongest lines or the so-called resonance lines for the alkali metals are
Li = 670 nm (falls in the red region)
Na = 589 nm (orange-yellow)
K = 769 nm (deep deep red)
Rb = 780 nm and 794 nm (still deep red)
Cs = 852 and 894 nm (near infrared, not visible to human eye)
Now you are right, K flame appears violet to us and Cs is indeed blue. As stated above, potassium salts in Bunsen flame also show
K = 404 nm (deep violet)
Now violet and red wavelengths appear somewhat lilac to us.
The same goes for Cs, the strongest emission is near infrared, but the visible spectrum has a faint line of 455 nm - this is bluish. Hence the flame appears blue. The name Cesium also comes from bluish gray. Rubidium comes from red from its red lines in the spectrum.
The source of wavelengths is a very old book by Grotrian.
The Bunsen flame spectrum of Lithium and Sodium is pure Li and Na spectrum. The sodium line is a doublet. I could not find the experimentally measured emission spectrum of K, Rb, and Cs.
You're absolutely right: the visual appearance of the potassium spectrum is a moderate purplish or lilac, but it has a very strong peak in near IR, which we don't see (but would likely show as very bright viewed with a digital camera, particularly with internal IR filter removed). See the spectra in this paper.
BTW, a digital camera clearly shows the light from IR LED remote controls, which you can sometimes, barely, see in a totally dark location. So potassium would make a good flare for IR photography.