There are many methods to detect and analyze cyanide ions,but there are some shortcomings.For example,the response time is very long,the sensitivity is not high,the selectivity of ions needs to be improved,or other methods must be taken to deal with interfering ions before detection.We synthesized a class of oxazine photochromic compounds containing naphthalimide groups,which showed good photochromic performance,good recognition performance for cyanide ions,high selectivity,good anti-interference ability,low detection limit and fast response time,and also had potential practical application value for online detection of cyanide ions.