All objects emit electromagnetic radiation, and the type and amount of radiation emitted depends on the object’s temperature. The hotter the object, the higher the energy of the emitted EM radiation: a cold object will emit radio waves and as temperature increases, microwaves, infrared, visible light, ultraviolet, x-rays and gamma rays.
The surface of the Sun is about 6000K which means that it produces light right across the spectrum, peaking in the green. It is this green coloured light that humans (and other land mammals with colour vision) are most sensitive to – you have twice as many green-sensitive cones as red- and blue-sensitive ones.
A standard incandescent filament lightbulb uses a titanium filament at a temperature of 1500K. This is significantly colder than the Sun which means less higher-energy green and blue light is emitted, leading to an overall yellow colour. Flourescent lighbulbs do not work in the same way so their colour temperature is adjusted by altering the mix of phosphors inside the bulb.
Left to right: simulated 6500K, 2000K, 2650K and 3000K compact fluorescent bulbs
I spend a lot of time in front of a computer screen; something that is not good for the eyes. I have a program called f.lux installed on my laptop that adjusts the colour temperature of my monitor automatically throughout the day; during the daytime the colour temperature is 6500K, after sunset it drops slowly to 3400K. This helps to reduce eyestrain and maintain circadian rhythms.