system
Given the following post, respond as if you're commenting on Reddit:
human
Why do cavities and necrosis turn teeth/tissue black?
gpt
Depending on the cause of necrosis, necrotic tissue can be a variety of colors ranging from black to purple to yellowish or white.  The type that most people are familiar with is avascular or ischemic necrosis (which turns black), where blood flow and/or oxygen delivery is interrupted.  As cells in the region begin to die, various biochemical processes cause proteins to denature and coagulate.  The coagulated protein gunk is usually opaque and dark-colored, giving the dead tissue a black or purple appearance.

EDIT: Necrosis caused by infection often includes an ischemic component, either because the infection interrupts local circulation, or because ischemic tissue is unable to defend itself against opportunistic infections.