Eight d-metal-containing N-butylpyridinium ionic liquids (ILs) with the nominal composition (C4Py)2[Ni0.5M0.5Cl4] or (C4Py)2[Zn0.5M0.5Cl4] (M = Cu, Co, Mn, Ni, Zn; C4Py = N-butylpyridinium) were synthesized, characterized, and investigated for their optical properties. Single crystal and powder X-ray analysis shows that the compounds are isostructural to existing examples based on other d-metal ions. Inductively coupled plasma optical emission spectroscopy measurements confirm that the metal/metal ratio is around 50 : 50. UV-Vis spectroscopy shows that the optical absorption can be tuned by selection of the constituent metals. Moreover, the compounds can act as an optical sensor for the detection of gases such as ammonia as demonstrated via a simple prototype setup.