This study utilized 1,2,4-triaminobenzene dihydrochloride and NaOH as precursors to prepare the pH optical sensor based on carbon dots (CDs). By incorporating CDs into pineapple peel cellulose nanofibrils (CNF) matrix, an intelligent label (CNF/CDs label) with colorimetric and fluorescent dual responsiveness was created for real-time monitoring of food freshness. The CNF/CDs labels exhibited remarkable sensitivity and recognizability towards pH changes from 1 to 12. They also demonstrated excellent reversibility during acid-alkali cycling. Moreover, these labels exhibited exceptional responsiveness to the alkaline and acidic gas environments formed by ammonium hydroxide and acetic acid solutions, respectively. These responses were visually distinguishable through visible color changes and ultraviolet (UV) fluorescence alterations. Encouragingly, the developed labels were successfully applied to monitor the freshness of prawns and fruits, enabling timely assessment of food freshness levels. The dual-mode response of color and fluorescence provided double assurance for the accuracy of the results.