In this work, the products formed by the reaction between 2,3-dibromonaphthalene-1,4-dione with (pyridine-2-yl)methanamine and (pyridine-4-yl)methanamine are discussed in detial. The products 2-amino-3-bromonaphthalene-1,4-dione (A) and 2-aminonaphthalene-1,4-dione (B(1)) obtained are characterized through 1H and 13C-NMR, FTIR, mass spectrometry, single-crystal X-ray diffraction experiments, which are in conjunction with wB97X based density functional theory. Compound A can effectively and selectively detect Hg2+ and Ni2+ ions, and proposes a potential mechanism of action.