Colorimetric sensing has been widely used for centuries across diverse fields, thanks to easy operation with no electricity and uncompromised high sensitivity. However, the limited number of chromogenic systems hampers its broader applications. Here, we reported that carbon nitride (CN), the raw materials-abundant and cheap semiconductors with photoelectron storage capability, can be developed as a new chromogenic platform for colorimetric sensing. Beyond most photoelectron storage materials that only demonstrated blue color in the excited state, CN could also exhibit brown color by terminal group functionalization. The experiments and DFT theoretical calculation revealed the origin of the unusual two types of color switches. Cyano and carbonyl terminal groups in CN elongated the centroids distance of electron/hole and stabilized the excited states through a physical and electrochemical pathway, respectively; meanwhile, the counter cations strengthened these processes. As a result, the CN-derived colorimetric O2 sensors demonstrated excellent reversibility in recycling hundreds of times for detection, and exhibited adaptable limit of detection and linear detection range, which was superior to commercial O2 sensors, especially for complex systems with broad variable concentrations.