optical absorption
Leave a black car in the sun and it becomes an oven; a white one stays cooler. The black paint absorbs the light and turns it into heat, while the white reflects it away. Optical absorption is a material soaking up light: the light's energy is taken in and converted to something else, usually heat, sometimes a re-emitted glow. Whether a material is dark, colored, transparent, or a heater depends on which light it absorbs and which it lets pass.
At the atomic level, light is absorbed when a photon hands its energy to an electron, kicking it up to a higher allowed energy level, but only if the photon's energy matches an available jump. This selectivity is the key. In an insulator or semiconductor there is an energy gap (the band gap) between filled and empty electron levels; a photon can be absorbed only if its energy exceeds that gap. Visible light carries about 1.8 to 3.1 electron-volts per photon, so a material with a gap larger than 3.1 eV cannot absorb any visible light and looks colorless and clear (like pure glass or diamond), while a gap of around 2 eV absorbs the higher-energy blue and green and lets red through, giving color. The intensity falls off exponentially with depth, described by Beer's law, I equals I0 times e^(minus alpha times x), where alpha is the absorption coefficient.
Absorption is where light energy goes to do work or make trouble. It is how solar cells harvest sunlight, how your skin makes vitamin D, how sunglasses and welding masks protect your eyes, and how a microwave heats food. In metals there is no gap at all, so free electrons absorb photons of every visible energy, which is why a metal surface would be black except that those same electrons immediately re-radiate the light as reflection, making it shiny instead. An important distinction: absorbed light is genuinely converted to other energy and does not come out the far side, unlike reflected or transmitted light, and a material that absorbs strongly across all visible wavelengths is simply black.
Pure glass has a band gap above 3.1 eV, so no visible photon has enough energy to be absorbed and it stays clear; ruby's chromium impurities absorb green and blue and let red through, so it glows red.
A photon is absorbed only if its energy matches an allowed electron jump; the band gap sets the cutoff.
Absorbed light is converted to heat or re-emission and does not exit the far side, unlike transmitted light; the amount absorbed depends on wavelength, which is exactly why materials have color rather than being simply light or dark.