An object that does not reflect light that is at a constant temperature emits a spectrum of light according to Planck's law. At different temperatures the shape and intensity of the spectra are different. And so the colour of that object appears to be different.

Drag left and right to adjust the temperature. The sun is roughly 5800K, the spectrum underneath is the approximate shape of the spectrum of sunlight as it leaves the sun. Different stars are at different tempteratures and appear to be different colours.

Note the spectrum at the bottom is mixed with faint white light (or grey) here. This brings the colours within the renderable space of your screen and you can imagine how the true colours of the spectrum might appear without the grey.