Heating NaCl in an atmosphere of sodium vapor creates F-centers, which are anionic sites occupied by unpaired electrons. These centers absorb light in the visible region, causing the crystal to appear yellow.