The short answer to your question is "Photons do not have a temperature. "
The long answer: unfortunately, almost everything you've quoted from the internet is either manifestly untrue or true only of a specific case. Thermodynamics and statistical mechanics are among the most poorly taught and understood concepts in science, so while unfortunate, I'm not surprised how far wrong the internet goes.
So let's review the statements and fix/amend them as needed.
Temperature is a measure of the average kinetic energy of the particles in an object
This is not true in general, and in fact, gets it backwards! It's like saying "An oven has a gas supply because it is hot. "
Temperature is a concept of systems at equilibrium with respect to exchanging energy with another system.
- a system: without getting too philosophical, draw a box around your photon, and other things of interest. That box and its contents and their interactions are your system
- equilibrium: means some property of your system, such as temperature or total energy or pressure, that is not changing in time
The definition of temperature $T$ is $$T = \left(\frac{\partial U}{\partial S}\right)_{V,N}$$
In other words, temperature is a measure of how much the total energy $U$ of your system needs to increase to get another unit of entropy $S$ .
- low temperature: it doesn't take much energy to add a lot of entropy. Example: a very cold solid. Adding even just a bit of energy gives your system access to all kinds of new microstates: new vibrational modes, torsion, maybe even magnons and defect movement
- high temperature: it takes a lot of energy to gain more entropy. Example: plasma. The particles already have access to a lot of positional arrangements, so it will take a LOT more energy to give them access to even more microstates (the meaning of microstates is relevant, but beyond what's needed here).
This is why heat energy flows from hot to cold: to maximize entropy. The cold object gains a lot of entropy with a bit of heat input, while the hot object loses little entropy with a bit of heat loss. So entropy is maximized by heat flowing from hot to cold. (why maximize entropy? It maximizes the number of microstates, and thus makes the maximum entropy state the most likely one at any given time - and the odds increase exponentially with entropy).
For the particles: when you have an ideal gas, the particles don't interact. At thermal equilibrium, i.e. constant temperature, the definition of temperature above means we've fixed $\frac{\partial U}{\partial S}$ . The math gets a bit complicated but in the end
- fixed temperature means the relative probability of each state (in this case: velocity of the ideal gas particles) is a function of their energy and the temperature
- so we can calculate the average velocity
So the statement is
- a special case, for ideal gasses - temperature is about the whole system and all its interactions and possible configurations. An ideal gas is special because only velocities affect the total energy, by definition. Hence the (average) velocity-temperature relationship. If you were looking at another system, like a rubber band (another famous statistical mechanics demo problem) then velocity is completely beside the point!
- backwards: the particles have a known average velocity because they're at a fixed temperature. If the particles weren't in equilibrium, then their velocities would change on average until they reached thermal equilibrium again
Temperature should be the result of friction
As we reviewed above, we now know that temperature is a concept completely separate from friction. You can have friction without being in thermal equilibrium and vice-versa.
Friction between two objects is the force you need to apply to move one object relative to the other. Since it's force, we know that force times distance is work: whatever moves the objects relative to each other is doing work on the system of two objects. That work can result in heat (admittedly extremely common), but it can also result in
- an electric field: rubbing a balloon on a sweater. See also: triboelectricity, triboelectric series
- light: smashing two quartz crystals releases a flash of light. See also: triboluminescence
- vibrations/sound: moving the bow over a violin string
So, does it mean that the particles of light (photons) somehow (maybe create friction and) generate the temperature?
So now that we understand entropy better: nope. Moving a photon doesn't require energy, so no friction force, and thus no friction. Photons can be absorbed and otherwise interact with things, but it's generally not a function of position. Photons don't even have a well-defined position! Their notion of position is even less defined than particles, which themselves don't have well-defined positions (see also: Heisenberg Uncertainty Principle, Schrödinger Equation). The probability of finding a photon somewhere is a function of all routes a photon can take to reach that point and their relative phases. See also: Fenyman's path integral formulation of quantum mechanics.
Shouldn't massless things not have a temperature?
Correct! 1. because temperature is a property of a system at thermal equilibrium, and 2. because a particle by itself typically is not a system of interest. We're generally interested in particles interacting with other particles.
Final item: So what's the deal with light and heat, anyway? Obviously, hot things glow, hence Edison and lightbulbs!
The reason is that
- unlike particles, which are generally conserved because mass is generally conserved (we're not at nuclear physics energies!), the number of photons in a system is NOT conserved
- in fact, the entropy of a system (how many states it can be in, and how likely those states are) is related to
- the number of photons in the system
- and the color (frequency/wavelength) of those photons
- These states are called "photon modes"
- and since we know that temperature is related to energy and entropy, the probability of each number of photons and their energies is a function of the temperature !
- The derivation is extremely similar to deriving the average velocity of ideal gas particles. Except the degrees of freedom are photon number and wavelength instead of velocity and wavelength
- and this is why hot things glow
What's the deal with "color temperature? " This question in the end is probably about reading about color temperature. For example, why can a lightbulb be marked "5000K" for "bright daylight" and "2700K" for "soft white? "
Just like ideal gas particles have an average speed that is a function of temperature, those photons from a hot object have an average frequency . Photons of all frequencies are present in various numbers, but they also have an average. The average also happens to be the most frequent. So just like an ideal gas has a 1:1 relationship between temperature and average speed, a hot object has a 1:1 relationship between its temperature and the average photon it emits.
For much more on this, search up "blackbody radiation." While you didn't want information about the wave nature of light, its wave nature is part of the derivation of blackbody radiation.
For a famous related paradox to blackbody radiation and a fun connection to Einstein's Nobel Prize for the photoelectric effect, you can also search up "the ultraviolet catastrophe. " You might like that because it refers to the particle nature of light, in particular, the fact that photons are quantized: you either have one (or two, three, ..) or 0. Never 0.1 photons.