Introduction

Color is essential for the evolution and survival of organisms, as it mediates their relationship with the environment for activities such as social signaling and camouflage1,2,3. Generally, there are two typical colorations in biological systems, pigmentary coloration and structural coloration4,5,6. Compared with structural coloration, pigmentary coloration can produce viewing angle-independent uniform colors via light absorption by chromophores7,8,9. The interaction between a chromophore and a specific wavelength of visible light determines the color of the organism. Such coloration mechanisms have inspired the creation of diverse color changing materials by integrating chromophores into polymeric or inorganic substrates via encapsulation10,11 or molecular design12,13,14 for various applications, such as smart windows15,16,17, mechanoresponsive sensors18,19, electrochromic writing boards20,21, and displays22,23. However, due to the limited diversity in the changes of the molecular configuration of chromophores to undergo color change, the existing materials cannot produce a wide range of visible colors with tunable color saturation and transmittance, which severely restricts their applications.

It has been reported that materials with metal-ligand complexes can display various colors depending on the coordination state24,25. To date, almost all materials with catechol-Fe3+ complexes have been developed by using Fe3+ ions to crosslink the polymer backbone with pendent catechols26,27,28,29. Although the main purpose of such an Fe3+-crosslinking strategy is to improve the mechanical, self-healing and shape-memory properties of polymer networks, materials with catechol-Fe3+ complexes can display the colors of green, blue, and red by manipulating the coordination states into mono-, bis- or tris-complexes26,27,28,29. When the catechol-Fe3+ complexes are in a mono-coordination state, all of the previously reported polymer networks based on poly(ethylene glycol) (PEG)26,28, hyaluronic acid (HA)27, or chitosan (CS)29 backbones are usually in the sol state and cannot maintain their shape due to a lack of sufficient cross-linking sites. Furthermore, none of these reported materials can achieve highly adjustable transmittance and color saturation because relatively high Fe3+ contents are necessary in these systems. To date, it has remained challenging to fabricate stable materials that can display a wide range of visible colors with tunable color saturation and transmittance.

Herein, we propose a novel strategy to create materials with a wide range of visible color tunability and highly tunable color saturation and transmittance. We designed and fabricated a novel, highly transparent hydrogel with poly(acrylamide-co-dopamine acrylamide) (PAD) networks swollen in a glycerol/water solution (PAD-G) (Fig. 1a) via free radical polymerization (Supplementary Fig. S1) followed by immersion in a glycerol/water solution containing Fe3+ to obtain a PAD-G-Fe3+ hydrogel. The covalently crosslinked polyacrylamide (PAM) backbone with abundant pendant catechols ensured that the proposed hydrogels maintained a very stable shape independent of changes in the Fe3+ concentration and pH value of the solution. These hydrogels contain a well-defined quantity of adjustable catechol-Fe3+ coordination bonds with flexible light-interacting configuration changes that can display a wide range of visible colors based on the complementary color principle30. The colors of the hydrogels are determined by the dynamic changes in configuration of the catechol-Fe3+ coordination bonds, which require different energies for energy level transitions (Fig. 1b, c). The catechol-Fe3+ complexes can dynamically switch between uncoordinated and mono-, bis- and tris-coordinated states to harvest light energy from a specific wavelength across the whole visible spectrum. As a result, these hydrogels display the colors of yellow, green, blue, and red, covering the three primary colors of both light and pigments. The hydrogel without coordination predominately exhibits a yellow color due to the absorption of light by free Fe3+ in water at a wavelength of ~398 nm. Upon catechol-Fe3+ coordination, according to crystal field theory, the d-orbitals of Fe3+ can undergo energy level splitting (Fig. 1b). Thus, these mono-, bis- and tris-complexes can absorb light photons with energies matching the crystal field splitting energy (Δ) to excite the electrons from low energy levels to higher energy levels, resulting in the appearance of different colors. For the mono-, bis- and tris-complexes with increased Δ values (Δm < Δb < Δt), light with higher energy but shorter wavelengths (λ values) is needed. Based on this energy requirement, the mono-, bis- and tris-complexes can absorb light with wavelengths of ~710, ~575, and ~490 nm, respectively, and the hydrogels display the complementary colors of green, blue, and red. Thus, dynamic control of noncomplexed or the presence of mono-, bis- and tris-complexes in the hydrogel can regulate the wavelengths of absorbed light as well as the primary colors observed to achieve a wide range of visible colors. The dynamically reconfigurable catechol-Fe3+ coordination states can be flexibly manipulated via simple adjustment of the pH value of the solution. As the pH value increases, the number of deprotonated catechol hydroxyl groups increases, resulting in the transition from no catechol-Fe3+ coordination (predominately at pH < 3) to mono-coordination (predominately at 3 < pH < 5.5), bis-coordination (predominately at 5.5 < pH < 8) and tris-coordination (predominately at pH > 8) (Fig. 1c). Because the Fe3+ concentration and pH value of the solution can be greatly varied without negative effects on the stability of the hydrogel, a wide range of visible color tunability and highly tunable color saturation and transmittance of the proposed hydrogel can be effectively achieved.

Fig. 1: Strategies for creating color-switchable smart hydrogels with wide visible color tunability.
figure 1

a PAD-G and PAD-G-Fe3+ hydrogels. b Energy level splitting of the d-orbitals of Fe3+ with different catechol-Fe3+ coordination, which can absorb a wavelength of visible light with an energy that matches its crystal field splitting energy (Δ), resulting in complementary colors across the wide visible range. Δm, Δb, and Δt are the Δ values of the mono-, bis- and tris-complexes, respectively. c Transition of catechol-Fe3+ coordination in the smart hydrogels between the noncomplexed and mono-, bis-, and tris-complexed states via simple pH adjustment.

Materials and methods

Materials

Acrylamide (AM), iron(III) chloride hexahydrate, N,N′-methylene-bis-acrylamide (MBA), glycerol, nitric acid, hydrochloric acid, sodium hydroxide, and ammonium hydroxide were purchased from Chengdu Kelong Chemicals. Dopamine acrylamide (DAM) was purchased from Hangzhou Minuo Chemicals. 2,2′-Azobis(2-methylpropionamidine) dihydrochloride (V50), N,N-di(hydroxyethyl)glycine (bicine), and 2-(4′-methoxynaphthyl)-4,6-bis(trichloromethyl)-1,3,5-triazine were purchased from Aladdin Chemicals. Deionized water (18.2 MΩ at 25 °C) from a Milli-Q Plus purification system (Millipore) was used throughout the experiments.

Hydrogel synthesis

Poly(acrylamide-co-dopamine acrylamide)-glycerol (PAD-G) hydrogels were synthesized by free radical polymerization. Typically, the monomers AM (1 g) and DAM (0.05 g), the crosslinker MBA (0.002 g), and the initiator V50 (0.006 g) were added to the precursor solution containing deionized water (3.2 ml) and glycerol (0.8 ml). The precursor solution was transferred to a cylindrical glass mold (diameter: 6 cm; height: 8 cm) and bubbled with nitrogen gas for 30 min to remove the dissolved oxygen. The cylindrical glass mold was sealed with a polyfluortetraethylene plate after nitrogen bubbling. The polymerization was carried out in a thermostatic chamber (TH-PE-100, JEIO Tech) with a relative humidity of 40% at 60 °C. The synthesized PAD-G hydrogel was immersed in deionized water for 2 days to remove unreacted chemicals. The hydrogel was then immersed in 100 ml of an aqueous solution containing Fe3+ (5 × 10−3 M) and glycerol (20 vol%) for 15 min to introduce Fe3+ into the crosslinked networks and construct the PAD-G-Fe3+ hydrogel. Similarly, polyacrylamide (PAM) hydrogels and poly(acrylamide-co-dopamine acrylamide) (PAD) hydrogels, used as control groups, were synthesized using the precursor solution (4 ml) without DAM and glycerol and using the precursor solution (4 ml) without glycerol, respectively. Then, the PAM and PAD hydrogels were immersed in 100 ml of an aqueous solution containing Fe3+ (5 × 10−3 M) for 15 min.

Morphological, structural and mechanical characterization

The morphologies and microstructures of the hydrogels were characterized by using a digital camera (D5600, Nikon) and scanning electron microscopy (SEM) (TM3030, Hitachi). The hydrogel samples were fractured mechanically after lyophilization and then sputter-coated with gold twice for 60 s each time. The chemical composition of the lyophilized hydrogel was characterized using attenuated total reflectance Fourier transform infrared (ATR-FTIR) spectroscopy (Nicolet is-50, Thermo Fisher Scientific) and Raman spectroscopy (DXR, Thermo Fisher Scientific). The Fe3+ content in the lyophilized PAD-G-Fe3+ hydrogel was measured using inductively coupled plasma optical emission spectroscopy (ICP–OES, Arcos, Spectro). The lyophilized hydrogel was dissolved in HNO3 (>68 wt%) and then dried in an oven at 200 °C for ICP–OES measurements. The mechanical properties of the hydrogel were analyzed using a rotational rheometer (DHR-1, TA) with a parallel plate (diameter: 40 mm). A frequency sweep was performed over the 0.1~20 Hz region with a 1% constant strain amplitude at 25 °C.

Anti-freezing property

The anti-freezing property of the hydrogel was examined with differential scanning calorimetry (DSC) (DSC 214 Polyma, NETZSCH) in the temperature range from 20 °C to −40 °C at a cooling rate of 10 °C min−1. Nitrogen gas was used as protective gas at a flow rate of 60 ml min−1 and as purge gas at a flow rate of 40 ml min−1.

Color-switching property

The colors of the hydrogels at different pH values were recorded using a digital camera. Bicine buffer solution (0.1 M) with 20 vol% glycerol was used for pH adjustment. The absorbance and transmittance spectra of the hydrogels at different pH values were measured using an ultraviolet–visible (UV–Vis) light spectrophotometer (UV-1800, Shimadzu) in the visible range (380~780 nm). Hydrogels with a size of 30 mm × 10 mm × 2.5 mm were placed into an optical quartz cell for measurement.

CIE coordinate diagram

The CIE coordinates for the hydrogels at different pH values were recorded using a fiber optic spectrometer (FLAME-S-VIS-NIR-ES, Ocean optics) in transmittance mode. A D65 light source coupled with an optical filter with transmittance of 1% was used for measurement.

Application demonstrations

Information encoders

The PAM hydrogel with 20 vol% glycerol (PAM-G) and the PAD-G hydrogel, each with a thickness of 2.5 mm, were cut into squares with a size of 10 mm × 10 mm and patterned onto transparent substrate plates to construct information encoders. The information encoders were placed into an aqueous solution with 20 vol% glycerol and Fe3+ (5 × 10−3 M) for a certain length of time to display the stored information.

Optical color filters

The PAD-G-Fe3+ hydrogel was sandwiched between two glasses to construct an optical color filter. The transmittance spectra of the PAD-G-Fe3+ hydrogels at different pH and [Fe3+] values were characterized using a UV–Vis light spectrophotometer. The hydrogel optical filter was mounted on a digital camera to take photos of a Rubik’s cube and colorful flowers. Hydrogel optical filters with different pH (4, 7, and 10) and [Fe3+] (1 × 10−2, 2 × 10−2 and 4 × 10−2 M) values were used to selectively enhance the colors of Rubik’s cube and flowers in the photos.

UV sensors

To sense UV light, a hydrogel strip at pH = 7 (size: 20 mm × 10 mm × 2.5 mm) was immersed in 10 ml of acetonitrile containing 2-(4′-methoxynaphthyl)-4,6-bis(trichloromethyl)-1,3,5-triazine (1 × 10−3 M) and then sealed in a transparent bag (size: 60 mm × 75 mm). 2-(4′-Methoxynaphthyl)-4,6-bis(trichloromethyl)-1,3,5-triazine can generate acid upon UV irradiation. One sealed hydrogel strip was placed into a transparent glass bottle, and another strip was placed in a UV-blocking brown glass bottle. After exposing both glass bottles to UV light (λ = 365 nm, 250 W) for a certain length of time, the hydrogel strips were removed and images were recorded with a digital camera.

Colorimetric sensors for the detection of acidic/alkaline vapors

The hydrogels were placed in a homemade transparent box (size: 30 cm × 20 cm × 20 cm) for sensing acidic/alkaline vapors. Briefly, 20 ml of vapor-generating solution was quickly added to a beaker (250 ml) in a transparent box at room temperature. HCl solution (37.5 wt%), CH3COOH solution (>99 wt%), NH3·H2O solution (25~28 wt%), and NH3·H2O solution (2.5~2.8 wt%) were used as the vapor-generation solutions. Then, a hydrogel strip (size: 20 mm × 8 mm × 2.5 mm) was immediately transferred onto a steel-wire mesh covering the beaker. When the hydrogel strip came in contact with the vapor that had evaporated from the solution in the beaker, the color of the hydrogel strip changed. This color changing process was recorded using a digital camera. To repeatedly sense acidic/alkaline vapors, the hydrogel strip was placed in a transparent box to detect vapors alternately evaporated from HCl solution (37.5 wt%) and NH3·H2O solution (25~28 wt%). For wearable use, a watch-like device (diameter: 3 cm; thickness: 1 cm) with a reservoir (size: 28 mm × 10 mm × 8 mm) to fix a hydrogel strip and a square window (size: 15 mm × 4 mm) to read the color was fabricated by 3D printing. The hydrogel strip (size: 20 mm × 10 mm × 2.5 mm) was mounted in the reservoir of the watch for colorimetric detection of acidic/alkaline vapors. Similarly, the hydrogel watch was exposed to an atmosphere polluted by HCl, CH3COOH, and NH3 in a transparent box to sense acidic/alkaline vapors. After exposure for 15 min, the color of the hydrogel in the watch was recorded using a digital camera.

Effects of additional metal ions on hydrogel color expression

Compared with the binding constants for catechol complexation with Fe3+ ions, the binding constants for catechol complexation with Cu2+ ions are much smaller, while those for catechol complexation with V3+ ions are similar (Supplementary Table S1)31. Because the binding constants for catechol complexation with metal ions might affect the stability of the complexes, Cu2+ and V3+ were chosen as typical metal ions for testing. PAD-G hydrogels were cut into square pieces and then immersed in 10 ml of aqueous solutions containing Fe3+, Fe3+/Cu2+, and Fe3+/V3+ for 15 min. The concentration of Fe3+ was fixed at 0.005 M, and that of Cu2+ or V3+ varied from 0.0025 M to 0.025 M. Then, the hydrogels were transferred to buffer solutions under different pH conditions for 2 h to reach equilibrium. The colors of the hydrogels were recorded using a digital camera.

Results and discussion

The fabricated PAD-G hydrogels exhibit highly transparent properties (Fig. 2a), which is beneficial for its optical characteristics. The freeze-dried hydrogel sample showed a homogeneously porous structure (Fig. 2b) that was confined by covalently crosslinked polymeric networks. The chemical structure of the hydrogel was confirmed by Fourier transform infrared spectroscopy (Supplementary Fig. S2) and confocal resonance Raman spectroscopy (Fig. 2c). In the Raman spectra, the peaks near 1265, 1321, 1427, and 1479 cm−1 in all of samples were attributed to the catechol ring vibrations, while the peaks near 595 and 643 cm−1 for the PAD-G-Fe3+ hydrogels at different pH values were attributed to the interaction between the phenolic oxygen atoms of catechol and Fe3+, confirming the catechol-Fe3+ coordination. To create stable polymeric networks for the desired coloration, covalently crosslinked PAM networks with abundant catechol moieties and predefined low concentrations of Fe3+ ([Fe3+]) were employed to construct the proposed hydrogels. The selected [Fe3+] in the solution and the immersion time were 5 × 10−3 M and 15 min, respectively, to ensure that a low quantity of Fe3+ was introduced to the hydrogels (Supplementary Figs. S3–S6). An excess of catechol groups compared with a low [Fe3+]guarantees that low quantities of catechol-Fe3+ complexes form, as determined by the [Fe3+], for notable and vivid color changes. Moreover, excess catechol and low [Fe3+] ensures sufficient Fe3+–catechol complexation, which prevents the diffusion-induced loss of Fe3+ from the hydrogel network. The equilibrium constant for the complexation between catechol and Fe3+ is 1040~1045, which is much larger than those for iron complexes with other oxygen-containing ligands30. Much evidence has indicated that the coordination between catechol and Fe3+ is strong and reversible over short time periods, and Fe3+ is inclined to coordinate with catechol rather than be oxidized32. The adjustable quantities of catechol-Fe3+ complexes in the PAM networks with an abundance of covalent crosslinks also benefit the flexible configuration changes of the catechol-Fe3+ complexes without compromising the mechanical strength of the hydrogels (Supplementary Fig. S7). Moreover, the transparent PAM networks with negligible visible light absorption (Supplementary Fig. S8) allow the desired wavelength of light to be absorbed by the catechol-Fe3+ coordination bonds to produce a color change without interference. In addition, the color change phenomena of the PAD-G hydrogels and Fe3+ solutions at various pH values confirm that there is no interaction between the polymer backbone and visible light (Supplementary Fig. S9). Upon increasing the pH value to 13, the PAD-G hydrogels gradually become slightly orange–red due to catechol oxidation. In addition, with the incorporation of glycerol into the networks33, the hydrogel cannot freeze even at −20 °C (Supplementary Fig. S10), enabling a wide workable temperature range for color switching.

Fig. 2: Structure and color switching of smart hydrogels.
figure 2

a, b Optical (a) and SEM (b) images of the smart hydrogel. c Confocal resonance Raman spectra of the PAD-G hydrogel and PAD-G-Fe3+ hydrogel at different pH values. d pH-dependent color change of the smart hydrogel.

With the ability to dynamically reconfigure catechol-Fe3+ coordination to selectively harvest light energy, these smart hydrogels enable wide visible color tunability (Fig. 2d). Typically, the noncomplexed hydrogel predominated at pH = 2 and showed a yellow color, while hydrogels with mono- (pH = 4), bis- (pH = 7) and tris-complexation (pH = 10) showed green, blue, and red colors, respectively. When the pH was in the transition range between two of the typical states, the ratio between the two relevant catechol-Fe3+ complexes can be adjusted to flexibly combine their respective colors with different intensities for a gradient color change. For example, as the pH increased from 4 to 7, the hydrogel possessed fewer mono-complexes and more bis-complexes. Such combinations of mono- and bis-complexes in the hydrogel lead to a variety of colors with a green to blue gradient change. The pH-dependent shift in the absorbance peak of the hydrogel clearly reveals the transformation of the catechol-Fe3+ complex from noncomplexed (398 nm) to mono- (710 nm), bis- (575 nm), and tris-complexed (490 nm) for wide visible color tunability (Fig. 3a). The color of the catechol-Fe3+ coordinated hydrogel is mainly determined by the amount of light energy required to match the Δ for the energy level transition. The Δ value can be calculated by the photon energy equation Δ = E = hv = hc/λ, where E is the absorbed light energy, h is Planck’s constant, and c and λ are the velocity and wavelength of absorbed light, respectively. By changing the pH from 4 to 10 to switch from mono- to tris-complexed catechol-Fe3+, the Δ value increases from 2.81 × 10−19 to 4.03 × 10−19 J per molecule (Fig. 3b). As Δ increases, the peak wavelength of absorbed light (λpeak) decreases from 710 nm to 490 nm, resulting in a color change from green to red (Fig. 3c). Such color changes are represented by chromaticity coordinates in CIE 1931 color space (for detailed coordinates, please see Supplementary Table S2). As the pH increases from 2 to 10, the CIE coordinates move from the yellow to red region via the green and blue regions, showing a wide change in the visible color of the hydrogel (Fig. 3d). Moreover, the transmittance and saturation of each color can be altered by regulating the quantity of catechol-Fe3+ complexes via changing [Fe3+] and changing the immersion time in the Fe3+-solution. Typically, with increasing [Fe3+] from 0.001 M to 1 M to form more catechol-Fe3+ complexes, the hydrogel transmittance of green (pH = 4), blue (pH = 7) and red (pH = 10) can be regulated across a wide range of 88.36%~2.78%, 75.69%~0.31% and 52.40%~0.03%, respectively (Fig. 3e). Moreover, the value of saturation (S) for green (pH = 4), blue (pH = 7) and red (pH = 10) increases with increasing [Fe3+] from 0.005 M to 0.015 M (Fig. 3f, Supplementary Fig. S11), exhibiting flexible saturation regulation. Thus, our color-switchable hydrogel allows uniform viewing angle-independent colors with tunable color saturation and transmittance compared to hydrogels with structural coloration, such as those with photonic crystals. Hydrogels based on photonic crystals are usually opaque and show viewing angle-dependent colors, which may compromise their wide application.

Fig. 3: Wide visible color tunability.
figure 3

a–c pH-dependent changes in the UV–Vis absorbance spectra (a) and the values of Δ (b) and λpeak (c) of the smart hydrogels for coloration purposes. d CIE coordinates for the colors of the smart hydrogel at different pH values. The arrow indicates the color change direction with increasing pH. e [Fe3+]-dependent transmittance of the smart hydrogels at λpeak = 546 (pH = 4), 458 (pH = 7), and 398 nm (pH = 10). f [Fe3+]-dependent change in color saturation (S) of the smart hydrogel at different pH values.

Smart hydrogels with wide visible color tunability are highly promising for diverse applications, as demonstrated by color filters and colorimetric sensors. The color filters with the PAD-G-Fe3+ hydrogel sandwiched between two glasses can transmit diverse colors of light for desired color regulation (Fig. 4a). Typically, by regulating the hydrogels to have mono- (pH = 4), bis- (pH = 7) and tris-complexes (pH = 10) to create green, blue, and red color filters, respectively, the relevant color of the Rubik’s cube (Fig. 4b) and flowers (Fig. 4c) in the photographs can be flexibly enhanced. Such color enhancement can be further adjusted by tuning the Fe3+ content (Supplementary Fig. S12). All-in-one color-switchable filters can be easily obtained by simply regulating the pH and [Fe3+] in the hydrogel. Therefore, the proposed smart hydrogel color filter can act as a multifunctional color filter for different colors. Among the commercially available color filters, none can achieve such a wide range of color changes.

Fig. 4: Diverse applications of the smart hydrogels.
figure 4

a–c Hydrogel color-switchable filter (inset in a) mounted on a digital camera (a) for imaging a Rubik’s cube (b) and flowers (c). d, e Hydrogel sensors for colorimetric (d) and repeated (e) detection of acidic and alkaline vapors. f–h Hydrogel sensors with a photoacid generator that produces acid upon UV exposure (f) for colorimetric UV detection (g) based on the UV-induced change in the absorbance spectrum of the smart hydrogel (h). After 5 min of UV exposure, compared with the hydrogel in the UV-blocking brown glass bottle, the blue hydrogel in the transparent glass bottle became green (g).

Moreover, the water-containing networks of these hydrogels allow easy capture of the water soluble acidic/alkaline vapors in polluted air for chemical sensing. By incorporating the hydrogels (pH = 7) into a portable detection device, a sensor for the colorimetric detection of acidic/alkaline vapors was fabricated (Fig. 4d). When placed in an environment with acidic or alkaline vapors (Supplementary Fig. S13), the hydrogel sensor provided fast and diverse color changes to indicate acid or alkaline pollution in air. Typically, the blue color of the hydrogel turns yellow within 60 s of contacting HCl vapor (37.5 wt%) (Supplementary Fig. S14a, Supporting Information), green within 480 s with CH3COOH vapor (>99 wt%) (Supplementary Fig. S14b), red within 80 s with NH3 vapor (2.5~2.8 wt%) and red within 20 s with NH3 vapor (25~28 wt%) (Supplementary Fig. S14c, d). The rate of color change depends on the exposure time, acidity/alkalinity, and vapor concentration. The hydrogels developed in this work can detect gas volatilized by NH3·H2O (2.5~2.8%) within 30 s. Moreover, the hydrogel sensor displays good reusability for the detection of acidic/alkaline vapors, as demonstrated by the repeatable λpeak values of the hydrogel after contact with CH3COOH and NH3 vapors (Fig. 4e). This proposed hydrogel sensor provides a simple and facile approach to detect acidic/alkaline vapors. Although there are many currently available types of paper, such as litmus, methyl red, and thymol blue, that are based on pH-sensitive substances to detect pH values in solutions, these materials cannot be used directly to detect gases due to their poor interaction with gas molecules in the dried state. Moreover, although pH indicator papers wetted with water may promote interaction with gas molecules, such papers still suffer from drawbacks such as poor water retention, their availability for single use only, and the loss of organic dyes due to undesired diffusion into water. In contrast, our hydrogel possesses hydrophilic crosslinked networks with pendant catechol moieties to ensure a high content of water that can store the gas molecules for detection and good retention of both water and the chromophores (catechol and Fe3+) for repeated colorimetric detection of acidic and alkaline gases. For example, these hydrogels exhibit good for water retention under a relative humidity of 80% at 20 °C and 50 °C, showing only 26.8% (20 °C) or 65.4% (50 °C) water loss after exposure for 8 h (Supplementary Fig. S15a). Even at 50 °C, the hydrogel remains in the gel state due to its covalently crosslinked PAM networks (Supplementary Fig. S15b). Moreover, the hydrogel can achieve ~100% recovery of both its color (Supplementary Fig. S16a) and weight (Supplementary Fig. S16b) after repeatedly losing water followed by reswelling in glycerol/water solution (pH = 4). Hence, these proposed smart hydrogels provide a universal color-switchable platform to develop multifunctional optical systems such as sensors and detectors.

Solvent-swollen networks of hydrogels allow flexible storage of functional components such as stimuli-responsive acidic/alkaline generators for colorimetric sensing of specific stimuli. For example, the incorporation of a solvent containing a photoacid generator (2-(4′-methoxynaphthyl)-4,6-bis(trichloromethyl)-1,3,5-triazine)34 into the proposed PAD-G-Fe3+ hydrogel network (pH = 7) can create a UV sensor (Fig. 4f). Upon UV exposure, the hydrogel color changes (Fig. 4g) because UV-induced acid generation (Supplementary Fig. S17) regulates catechol-Fe3+ coordination as well as the absorbance spectra (Fig. 4h). After only 5 min of UV exposure, the blue hydrogel in the transparent glass bottle became green, while the hydrogel in the brown glass bottle remained blue (Fig. 4g). Traditional UV sensors need cumbersome calibration, have relatively high costs and require manual data processing, and the colors of other hydrogels fade away after UV exposure35. Nevertheless, the hydrogel proposed in this study can record UV exposure information while maintaining their color. Therefore, this proposed smart hydrogel with wide visible color tunability provides a simple strategy to indicate the UV exposure of UV-sensitive chemicals and actives.

The proposed smart hydrogels may also find applications in the field of information encoders. With transparent PAM-G and PAD-G hydrogels (pH = 2.7) prepatterned on substrate plates (Supplementary Fig. S18a, b), stored letters can be observed when contacting an Fe3+-solution (Supplementary Fig. S18c, d) due to color change upon catechol-Fe3+ complexation in the PAD-G hydrogel. Because Fe3+ is easily found in rusty iron instruments, using aqueous Fe3+ solutions for information encryption/decryption is quite simple and facile. Furthermore, the color expression of the proposed hydrogel can be further regulated and controlled by introducing additional appropriate metal ions, such as V3+ ions, into the hydrogel if the binding constants for catechol complexation with the metal ions are comparable to those for catechol complexation with Fe3+ ions (Supplementary Fig. S19).

Conclusions

In this study, we created a novel smart hydrogel containing a well-defined adjustable quantity of reconfigurable catechol-Fe3+ coordination bonds for displaying a wide range of visible colors with tunable color saturation and transmittance. By simply manipulating the quantity of each complex configuration, the smart hydrogels can harvest energy from selected wavelengths of visible light to display complementary colors across the wide visible range. The utility of these smart hydrogels is highlighted by their various uses as optical filters for the facile regulation of color and as colorimetric sensors for the sensitive detection of UV light and chemical vapors. This work offers general guidance to inspire the creation of advanced visible color-switchable materials by engineering diversity and altering the quantity of each molecular configuration for flexible light energy harvesting. This general guidance may not be limited to materials involving catechol-Fe3+ coordination bonds but could in principle be applicable to other materials involving light-harvesting coordination bonds between transition metal ions and ligands. Such smart hydrogels with a wide range of visible colors provide a universal color-switchable platform to develop multifunctional optical systems such as optical filters, sensors, and detectors.