A colorimetric cyanide ion (CN⁻) sensor 4-[(1E)-2-(2-hydroxyphenyl)ethenyl]-1-allylpyridinium bromide (2-HPEAPB) was synthesized via condensation and N-alkylation reactions using 4-methylpyridine and salicylaldehyde as the starting materials. 2-HPEAPB displayed good selectivity, fast response, and high sensitivity toward CN⁻ over other competing anions in acetonitrile–water (95 : 5, v/v) with a limit of detection of 8.0 × 10⁻⁶ mol L⁻¹ by the naked eye. The sensing mechanism and the influence of pH and temperature on sensing properties were investigated. Colorimetric test paper for CN⁻ was prepared by absorption of 2-HPEAPB to a chromatography paper, which could be used to detect CN⁻ directly and quickly. Analytical application of measuring CN⁻ concentration in an electroplating wastewater in real-time was conducted successfully. Copyright © 2015 Royal Society of Chemistry.