Simple, fast, and accurate detection of food freshness is of considerable significance to ensure food safety. The pH values of foods can be good indicators of their freshness, which can be used for real-time detection of food quality. Herein, we fabricated a pH-sensing film for flexible smart labels based on hydroxypropyl guar (HPG), cellulose nanocrystal (CNC), 1-butyl-3-methylimidazolium chloride (BmimCl), a kind of ionic liquid (IL), and anthocyanin (Anth). We investigated the structure, optical properties, and mechanical strength of the composite films. These films can be used to detect ammonia (NH 3 ) generated from seafood during storage by pH-sensing capability and monitor the real-time freshness of seafood. The HPG/CNC/IL/Anth film exhibited several advantages, such as wide color-change range, easy identification, high sensitivity, good reversibility, excellent stability, and low detection limit. The pH-sensing films can function as flexible smart labels for real-time, visual, and accurate detection of food freshness in cold chain logistics and other fields.