The K stands for Kelvin, which is a measurement of temperature. The relationship between temperature and color is called blackbody radiation. A blackbody is defined as a theoretical perfect absorber and emitter of radiation, i.e. it absorbs and emits no photons from it's existance. A blackbody of a given temperature will emit a known light curve (Plank's law), predictable intensity for a given frequency (color/energy) of light. Now these bulbs don't actually give off perfect blackbody light curves (not even close), but blackbody light curves have three features, Plank's law, Wein's law (a single intensity peak at a predictable color), and Stefan-Boltzmann's law (energy flux proportional to temperature to the 4th power).
So by looking at the shape of the light curve, the peak intensities, and the energy flux from a light bulb, along with a little fudging they can claim their light curve is close to a black body of a given temperature.
The sun is not a perfect blackbody, but it is pretty close to one with the temperature of the surface of the sun (~6000K). However, water absorbs red light preferentially, so the deeper you go, the "hotter" the apparent spectrum.