Introduction

Many of today’s advanced materials have been developed through biomimetic processes1, and photonic crystals also exist as nature-occurring materials, such as minerals and biological structures, which are characterized by structural color originating from Bragg diffraction of light due to their periodic structure. Research on nature-inspired artificial photonic crystals has been actively conducted recently because of their potential applications in sensors, displays, and other optical devices2,3. A typical example of nature-inspired photonic crystals is artificial opal, which is characterized by low cost, flexibility, and scalability4,5. These features make it easy to transform interesting candidate materials into photonic crystal materials. Opal-based templates have been widely applied as colorimetric sensors by incorporating various functional materials within the structure6,7,8.

For sensor applications, opal photonic crystals can be produced in film form or via the template-assisted approach9. Initially, film-type opals were frequently reported. When acrylate monomers responsive to pH changes are injected into opal templates made with silica or emulsion-polymerized spherical particles, the resulting hydrogel swells as the pH changes10,11. This swelling increases the gap between the opal particles, which causes a shift in the Bragg diffraction wavelength and corresponding color change, functioning as a sensor6,12.

Recent studies have reported photonic gel organic solvent sensor films created by self-assembling and polymerizing silica microspheres in a medium mixed with acryl monomers and ethylene glycol (EG)13. With EG evaporation, the photonic gel lost its structural color due to the refractive index matching between the hydrated gel and the silica microspheres. Various organic solvents produce distinct reflection spectra on the photonic gel, which can be utilized for organic solvent sensing. Lee et al. reported various colorimetric sensors for measuring pH, anions, glucose, and temperature via a film-type opal templating technique that leverages rapid evaporation12,14,15,16,17.

Research on the formation of opal structures via the template-assisted approach includes Yang et al.‘s work on photonic balls (PBs) created via a water-in-oil method18,19. In this technique, an aqueous silica dispersion in a specific nonpolar medium evaporates water to form spherical opals20,21, and various preparation techniques22, such as microfluidics23,24, electrospray20, microwave21, and bulk synthesis25, have been developed. PBs exhibit various structural colors depending on the viewing angle26,27 and can be used as templates to create inverse structures by incorporating other functional materials20,21. PBs can be readily formulated as ink due to their shape and dispersibility in liquid media, and a recent study demonstrated inkjet printing of PB28. In addition to the use of spherical PBs, Zhong et al. produced rod-shaped opal templates by filling glass capillaries with a silica dispersion and evaporating the solvent. These templates were used to make cholesterol sensors by injecting sucrose followed by carbonization29. When saccharides are carbonized through chemical or thermal dehydration reactions, numerous hydrophilic functional groups remain along the carbonized main chain, provided that the temperature is not extremely high. The chemical structure of the carbonized product falls into the category of substances such as humin, which is a naturally occurring insoluble macromolecular substance that constitutes 50% of the organic matter in soil. Humin has recently gained attention for its catalytic activity due to its electron-mediating ability30. In general, humin is produced through various chemical reactions, as organic materials such as fallen leaves decompose in the soil. It contains aromatic hydrocarbon main chains with various hydrophilic functional groups and is both hydrophobic and hydrophilic. Recently, the electrochemical properties of humin have led to its utilization as a catalyst for biological nitrogen fixation via anaerobic microorganisms31. Artificial humin can be synthesized via a biomimetic process involving dehydration of sugars32,33.

In this study, we investigate a nature-inspired material of humin-like carbon photonic balls by an opal-templated thermal dehydration method and explore its potential for color-tunable sensor applications.

Materials and methods

Materials

For emulsion polymerization of the PS microspheres, potassium persulfate (Merck, ACS Reagent), sodium dodecyl sulfate (Merck, ACS Reagent), and styrene (Merck, 99%, stabilized with 4-tert-butylpyrocatechol) were purchased. For the preparation of the photonic balls, n-hexadecane (Alfa Aesar, 99%), polyglycerol polyricinolate (PGPR, Sigma), and n-hexane (DUKSAN, 99.9%) were used as received. For the preparation of carbon photonic balls, D-(-)-fructose (Merck, 99%), ethyl alcohol (Merck, 99.9%), sulfuric acid (Merck, 99.9%), and tetrahydrofuran (Tetrahydrofuran, 99.9%, inhibitor free) were purchased and used as received. For the sensing experiments, potassium hydroxide (Merck, reagent grade, 90%, flakes), hydrochloric acid (Merck, ACS reagent, 37%) and 1-decanol (Merck, 99%) were used.

Preparation of PS microspheres and PS photonic ball templates

A 250 mL round-bottom flask (RBF) was filled with 100 mL of distilled water and stirred while purging with nitrogen for 1 h. Afterward, 0.10 g of potassium persulfate (Merck, ACS Reagent) and 0.12 g of sodium dodecyl sulfate (Merck, ACS Reagent) were added, and the mixture was subsequently heated to 80 °C with stirring. After 30 min, 10.0 mL of styrene (Merck, stabilized with 4-tert-butylpyrocatechol) was added. The reaction was terminated after 4 h, and the reaction mixture was dialyzed in distilled water for 2 weeks via a dialysis membrane.

PGPR (Polyglycerol polyricinoleate) (0.20 g) was dissolved in 100 mL of n-hexadecane (Alfa Aesar, 99%). The mixture was heated to 60 °C while stirring. After 30 min, 5.0 mL of an aqueous dispersion of PS microspheres was slowly added. The mixture was stirred for 5 h, after which the dispersion was filtered through a nylon mesh to collect the PS photonic balls. The photonic ball was washed with n-hexane (DUKSAN, 99.9%), air dried, and stored for later use.

Preparation of carbon photonic balls and colorimetric pH sensors

First, 2.0 g of D-(-)-fructose (Merck, 99%) was dissolved in a mixed solution of 10 mL distilled water and 10 mL ethyl alcohol (Merck, 99.9%). Then, 0.200 mL of sulfuric acid (Merck, 99.9%) was added, and the mixture was stirred thoroughly. PS photonic balls (0.3 g) were placed into a 25 mL glass vial, and 1.0 mL of the carbon precursor solution was added to the vial, ensuring thorough absorption by leaving it for 1 h. The mixture was subsequently heated in an oven preheated to 70 °C for 6 h. After the reaction was complete, the PS in the photonic ball was dissolved in tetrahydrofuran (MERCK, 99.9%, inhibitor-free). The dispersion was poured on a nylon mesh to collect the carbon inverse photonic balls (CIPBs).

Aqueous solutions at pH 3, 4, 7, 13, and 14 were prepared by mixing potassium hydroxide (Merck, reagent grade, 90%, flakes) in citrate buffer (Merck, ACS reagent). The carbon photonic balls were added to each pH solution contained in separate vials. After 30 min, the photonic balls were filtered through a nylon mesh, and the reflection spectrum was measured via a spectrometer (Avaspec-3658, AVANTES).

Characterizations

Scanning electron microscopy (SEM) images were obtained with a field emission scanning electron microscope (SU3800, Hitachi). An X-ray photoelectron spectrometer (XPS) (Nexsa™, Thermo Scientific) system was used for elemental analysis of CIPB. Microscopy images of the CIPB samples were captured via an optical microscope (BA310MET Metallurgical Microscope, MOTIC), and the reflectance spectra of the focused spot were measured via a fiber optic UV‒Vis spectrometer (Avaspec-3658, AVANTES) attached to the microscope.

Results and discussion

The entire fabrication process of the carbon photonic ball was illustrated in Fig. 1a. For the preparation of carbonaceous photonic crystals with an inverse opal structure, the fabrication of opalline photonic balls (PBs) is a prerequisite. In this study, a bulk preparation method was optimized for the mass production of a PB template25. The water-in-oil droplets of the PS microspheres underwent diffusive drying of water to PB in preheated n-hexadecane at 60 °C, during which colloidal self-assembly occurred, as shown in Fig. S1. As emulsion-polymerized polystyrene (PS) microspheres of three different sizes (220 nm, 250 nm, and 280 nm) were used, the produced PBs were named PB220, PB250, and PB280 by PS size. Characterization of dried PB by optical and electron microscopy revealed a strong reflective color due to the opalline structure and a spherical shape with an average diameter of 80 μm, as shown in Figs. S1 and 1b. Figure 1b shows an optical microscopy image of the iridescent color from individual PB250 particles, and an electron microscopy image of a broken piece of PB250 shown in Fig. 1c demonstrates that the cubic closed packed structure is maintained even inside the PB.

To create carbon inverse photonic balls (CIPBs), a mixture of fructose and sulfuric acid/ethanol was infiltrated within the interstices of the opalline PB. Several studies have confirmed that fructose undergoes carbonation faster than glucose does29. The use of ethanol ensured the uniform absorption of fructose, and the condensation reaction occurred via an acid-catalyzed reaction with sulfuric acid at 70 °C followed by further condensation at 100 °C, as shown in Fig. 1a. At elevated temperatures, the increased sulfuric acid concentration caused by water evaporation expedites fructose oxidation, resulting in the formation of humin-like carbonaceous structures along with the darkening of color (Fig. S2).

Fig. 1
figure 1

(a) Fabrication procedures for carbon inverse photonic balls by infilling a photonic ball template with fructose and sulfuric acid, thermal dehydration, and chemical etching. The illustration was created using Rhino 6 (https://www.rhino3d.com/). (b) Optical microscopy image of PB250 and scanning electron microscopy images of (c) an exposed cross-section of PB250 showing an opalline structure and (d) the size distribution of CIPB250 before and after carbonation. CIPB250 (e) at low magnification showing spherical particles, (f) at high magnification showing the surface inverse opal structure.

Subsequent removal of the PS microsphere template using an organic solvent leaves behind the inverse opal structure of humin derivatives, which can also be dispersed well in various organic solvents and water. Owing to their molecular weights, humin derivatives consist of humic acid and humin, which all exhibit extremely low solubilities, thereby remaining intact in organic solvents30. As shown in Fig. 1d, the average size of the CIPBs decreased by approximately 20% (82 μm to 65 μm) after thermal condensation. The formation of CIPB with an inverse opal structure by removal of the PS template was confirmed through SEM imaging (Fig. 1e, f).

CIPBs maintained a spherical morphology after etching, with designations CIPB220, CIPB250, and CIPB280 based on the size of the templates used. Further images are summarized in Fig. S2. As mentioned earlier, the use of fructose as a carbon precursor provided the best CIPB structure after carbonation. When other sugars, such as glucose or sucrose, are used, the resulting structural colors are confirmed to be much weaker and less reproducible. (Fig. S3)

Owing to the black color of CIPB from the highly conjugated molecular structures of the humin derivatives, light scattering was suppressed, and characteristic structural colors were observed under front illumination due to light diffraction from the inverse opal structure, as predicted by Bragg’s law. Figure 2a ~ c show blue, green and reddish structural colors from CIPB220, CIPB250 and CIPB280, respectively, dispersed in ethanol due to their different lattice spacings. In particular, the iridescent colors of individual CIPB280s strongly depend on the viewing angle.

Fig. 2
figure 2

Photographic images of (a) CIPB220, (b) CIPB250, and (c) CIPB280 dispersed in ethanol showing different structural colors. (d) CIPB280 sedimented in ethanol showing various structural colors at the top layers with illumination from the 30° zenith angle. The dispersed CIPB280 particles also show angle-dependent structural colors. (e) Schematic description showing distinct colors of CIPB280 due to different Bragg conditions. (f) Magnified photograph showing individual particles of CIPB280 with slightly different structural colors due to crosslinking density.

Figure 2d shows the same CIPB280 dispersion shown in Fig. 2c, which sedimented on the bottom of the glass vial, exhibiting various structural colors at the top layers due to different viewing angles with light illumination coming from the30° zenith angle (Φ). The dispersed CIPB280 particles also presented various colors depending on the viewing distance. (far: blue, mid: green, near: red) Different structural colors due to the distinct Bragg conditions under the same illumination angle (Φ) are schematically described in Fig. 2e.

Viewing angle-dependent color changes from CIPB280 can be confirmed from a supplementary movie clip in which wet CIPB280 sediments show blue-shifted structural color when the camera position moves from top to side. When CIPB280 sediments near the inner wall of glass vials with reddish structural color are magnified, some CIPB particles show distinctive colors due to the different degrees of shrinkage during the carbonation stage. (Fig. 2f) As dehydration of the fructose solution took place in a static oven, the locally heterogeneous distribution of the precursor within the PB template and its effect on the degree of carbonation could not be avoided. The use of mechanical agitation during carbonation is expected to improve such color heterogeneity.

The tunable structural colors of CIPBs were more rigorously investigated, as shown in Fig. 3. As shown in Fig. 3a, the ethanol dispersion of CIPB250 under a white background apparently has a black color, as the light is absorbed by the humin-like molecular structure of CIPB. However, if the illumination shines from various azimuthal angles, structural color changes occur. The effect of the incident light azimuthal angle on the diffraction wavelength of CIPB250 in THF is described in Fig. 3b, and photographs taken at illuminations from 30, 45, and 80° azimuthal angles are shown in Fig. 3c, d, and e, respectively. Although CIPB250 and CIPB280 exhibit strong angular dependence on structural color due to a highly crystalline opal structure, CIPB220 showed relatively lower viewing angle dependence probably due to the partial incorporation of randomly oriented PS particles during the fabrication stage of photonic ball template. There are literatures on “photonic glass” in which amorphous packings of the uniform-sized particles exhibit non-iridescent structural colors that are independent of viewing angle34.

As the diffraction wavelength and resulting structural color of the photonic crystal can also be tuned by the effective index of refraction (neff) in Bragg’s law, CIPB250 dispersions were prepared in various organic solvents with different indices of refraction, as shown in Fig. 3f. On the left, methanol (n = 1.326), n-hexane (n = 1.375), 2-propanol (n = 1.378), tetrahydrofuran (n = 1.407), methylene chloride (n = 1.413), and chloroform (n = 1.446) were used as dispersing media, with the refractive indices of the CIPB250 sediments exhibiting redshifted structural colors in increasing order. As CIPB possesses both hydrophilic functional groups and hydrophobic hydrocarbon backbones, it can be dispersed in various organic solvents. Rigorous characterizations of the molecular structure of CIPB will be discussed later. Owing to the relatively high mass density of methylene chloride (d = 1.33 g/cm3), the CIPB250 dispersion showed very slow sedimentation, and that in chloroform (d = 1.49 g/cm3) floated on the surface due to density inversion.

Fig. 3
figure 3

(a) Schematic drawing showing absorbed light and diffracted light from different azimuthal angles of incidence by Bragg’s law. (b) CIPB280 in THF showing a black color due to light absorption. Various structural colors of CIPB280 in THF from illuminations with azimuthal angles of (c) 30°, (d) 45°, and (e) 80°. (f) CIPB250 dispersions in various organic solvents: methanol (n = 1.326), n-hexane (n = 1.375), 2-propanol (n = 1.378), tetrahydrofuran (n = 1.407), methylene chloride (n = 1.413), and chloroform (n = 1.446). (g) The same dispersions viewed from the white background showing black dispersions. Dispersions of (h) CIPB220 and (i) CIPB250 in mixed solvents of ethanol and toluene with different volume ratios from 100:0 (n = 1.33) to 20:80 (1.47) to show structural color changes. (j) Reflectance spectra of CIPB220 in five different EtOH/toluene mixtures. (k) λPeak vs. refractive index plot showing a linear increase in the diffraction wavelength with increasing refractive indices of the EtOH/Tol mixtures.

These phenomena are more obvious in Fig. 3g, where the same dispersions are placed on a white background, which indicates that the density of CIPB is approximately 1.4 g/cm3. All CIPB dispersions are black in color and have negligible solubility in every solvent used. At a fixed viewing angle, one can obtain fully visible structural colors from CIPB dispersions by changing the volume % of two organic liquids with distinct refractive indices. As shown in Fig. 3h and i, the photonic inks of CIPB220 and CIPB250 dispersed in mixed ethanol (n = 1.329, d = 0.789) and toluene (n = 1.497, d = 0.867), with varying vol% (with 20% increments), respectively, exhibited full color spectra within the entire visible range. The photographs were taken immediately after the samples were agitated; otherwise, the CIPBs were deposited on the bottom because of the low mass densities of both liquids, as shown in Figure S4a. To extract quantitative information related to structural color changes, the optical microscopy data from individual CIPB220 particles were sent to a UV‒Vis spectrometer via a custom-made setup, as shown in Figure S5, to obtain the reflectance spectra of a focused particle in different liquids, as shown in Fig. 3j. Owing to suppressed light reflection from a single black CIPB particle, the reflectance signal was weaker than that of a typical opal film12,21. As predicted by Bragg’s law, the peak reflectance (λpeak) of CIPB220 clearly red-shifted with increasing neff. As each CIPB shows slightly different structural colors, the measured λpeak values from 12 CIPBs in the given liquid were averaged (Figure S6) and plotted in Fig. 3k as a function of the refractive index of the given liquid, revealing linear responses. Although CIPB exhibits very low solubility in most organic solvents, it was observed that CIPB swells slightly more in polar solvents such as EtOH compared to non-polar aromatic solvents like toluene. This trend can explain the observations in Fig. 3k, where the decrease in λpeak and deviation from linearity occur as the polar EtOH content decreases in the liquid mixture. Similar to the photographs shown in Fig. 3h and i, CIPBs also exhibit various structural colors in styrene(n = 1.516)/methanol(n = 1.326) liquid mixtures with varying compositions. Changes in structural color for CIPB220 and CIPB250 sedimented in methanol/styrene with varying compositions are shown in Figure S4b. The results shown in Fig. 3f ~ k and Figure S4 indicate that the CIPB can be utilized as a colorimetric refractive index sensor35.

To investigate the chemical structure of CIPB, dried CIPB250 was characterized via XPS, and the results are shown in Fig. 4a and b. XPS analysis revealed that not only C‒C bonds but also C‒O single and double bonds from carboxyl groups and carbonyl groups were present.

The molar content of oxygen was as high as 9% at 70 °C, which decreased to 6% after 100 °C annealing, as shown in Table 1. As shown in Table 1, trace amounts of sulfur were also detected, which originates from sulfuric acid and related products.

Table 1 Elemental compositions of CIPB250 characterized by XPS.
Fig. 4
figure 4

XPS spectra of CIPB250 for (a) C1s and (b) O1s, with peak deconvolutions. FT-IR spectra of CIPB250 (c) after thermal condensation at 70 °C and (d) after additional annealing at 100 °C, showing fewer hydroxyl groups and more C = C groups, as indicated by the green and yellow bars.

Figure 4c and d shows the FT-IR spectra of CIPB250 obtained from thermal condensation at 70 °C and additional annealing at 100 °C. The OH peak at approximately 1400 cm-1 indicates that the hydroxyl group weakens upon further annealing, and the peaks from C = O stretching at 1750 cm-1 and sp2 C = C at 700 cm-1 indicate the existence of carbonyl groups, carboxyl groups, esters, and various benzene derivatives, which are characteristic functional groups in humin.

On the basis of the characterization results, a probable humin-like molecular structure of CIPB, which consists of crosslinked polymeric furanose chains with various functional moieties consisting of C, H, and O atoms such as carboxylic groups, can be drawn, as shown in Fig. S7.

In hydrated CIPB with bound acidic functional groups, such as carboxylic acids, as partly shown in Fig. 5a, protons can be lost, and negative charges accumulate above pH 5, which is the pKa of carboxylic acid, leading to osmotic pressure development followed by swelling of the bead driven by water influx, as shown in Fig. 5b. This swelling causes a shift in the interlayer spacing of the IO structure, resulting in an overall redshift in the diffraction color (Fig. 5c). In our previous reports, an IO-structured hydrogel containing carboxyl groups exhibited pH-responsive color changes12,14. Although CIPB is not a hydrogel, it can be dispersed in aqueous media without further chemical modification due to the presence of abundant hydrophilic functional groups, as shown by the characterization results. When thermal condensation is carried out at temperatures higher than 100 °C, the dispersity of CIPB in water substantially decreases owing to the reduction in hydrophilicity disabling pH-driven swelling.

Fig. 5
figure 5

Schematic illustrations showing a partial region of CIPB280 (a) at pH 3 with protonated carboxyl groups in the humin matrix, (b) at increased pH with anionic carboxylates and water molecules entering the CIPB matrix to compensate for the osmotic pressure, and (c) at pH 13 with a swollen CIPB IO matrix. The illustrations were drawn using Rhino 6 (https://www.rhino3d.com/). (d) Three aqueous dispersions of CIPB280 in buffer solutions with different pH values of 3, 7, and 13. (e) Reflectance spectra obtained from a CIPB280 at pH 3 and pH 13, with inset images showing individual CIPB280 at each from optical microscopy. (f) Size distributions of CIPB280 at pH 3 and 13. Magnified stereoscopic images of CIPB280 at (g) pH 3, (h) 1 min after being transferred to pH 13, and (i) 60 min later at pH 13. (j) Plot of the normalized peak reflectance (λpeak at pH 13/λpeak at pH 3) measured from a CIPB280 single particle upon repeated changes in pH between 3 and 13 every 30 min.

To examine the pH-responsive swelling of CIPB, aqueous dispersions of CIPB280 were prepared using mixed buffer solutions of citrate and potassium hydroxide at pH values of 3, 7, and 13. As shown in Fig. 5d, red shifts in structural color were evident for the CIPB280 dispersions as the pH increased. The reflectance spectra of a focused particle at pH 3 and pH 13 are shown in Fig. 5e. At pH 3, the spectrum exhibited a peak at 540 nm, which redshifted to 595 nm (~ 10% increase) as the pH increased to 13. Each spectrum was obtained from a single CIPB280, as shown in the inset images in Fig. 5e, which are optical microscopy images of individual CIPB280 particles at pH 3 and pH 13 that exhibit green and orange structural colors, respectively. As the pH-driven structural color change originated from the swelling of CIPB, the average particle size should also increase. Figure 5f shows the size distributions of CIPB280 particles measured at pH 3 and pH 13, which clearly reveal the swelling of CIPB with increasing pH. CIPB220 also showed swelling behavior and color changes upon pH increase as shown in Fig. S8. In addition to the increased particle size, Fig. 5f also shows that the size distribution was broadened upon swelling. As mentioned earlier, there is inevitable heterogeneity in the crosslinking density of CIPBs, which results in broadening of the size distribution as well as the inherent particle size distribution. The heterogeneity in the swollen size of individual CIPB particles at a given pH implies that their structural color can vary upon swelling. Figure 5g ~ i show three stereoscopic images of CIPB280 taken at pH 3, 1 min after increasing to pH 13, and 60 min later. As shown in the kinetic plot of λpeak for 5 min (Fig. S9), an initial 5% increase in λpeak occurred as fast as 10 s, but it continued to redshift to 10%, as shown in Fig. 5e, for an hour. Although the overall structural colors of the particles at pH 3 and pH 13 in their equilibrium state are green and orange, respectively, as shown in Fig. 5d, those in the short term after the pH increases appear to be diverse, as shown in Fig. 5h, presumably due to the heterogeneous degrees of crosslinking as well as the distinct carboxylic group densities among the particles.

Although some particles changed color to orange with increasing pH, yellow particles and those with a green structural color also existed. Nonetheless, the heterogeneous structural colors sooner or later converge to orange, implying that such heterogeneity arises from kinetic factors. To examine the repeatability of the sensing response, peak reflectance positions were measured from a single CIPB280 particle under repeated pH changes between 3 and 13 every 30 min. As shown in Fig. 5j, six λpeak values at the corresponding pH values were normalized to the initial λpeak at pH 3 and plotted to show outstanding reproducibility. The reversible color changes caused by consecutive pH variations were confirmed by independent spectral measurements from CIPB250, as shown in Fig. S10. These results confirmed that the pH-responsive color changes of CIPB are reversible, and thus, CIPB can be utilized for continuous pH monitoring of water systems. Since humin-like CIPBs exhibit high-definition structural colors due to minimized light scattering, they can be adapted for various colorimetric sensor applications through surface modifications of functional groups, and further engineering of dispersing media will allow versatile applications as stimuli-responsive photonic inks.

Conclusion

In this study, humin-like carbon inverse photonic balls (CIPBs) with an inverse opal structure were investigated. First, the photonic balls were prepared through colloidal self-assembly of polystyrene microspheres during the diffuse-drying process of water-in-oil. After infiltration of a fructose-sulfuric acid mixture into the PB templates and subsequent thermal dehydration, the fructose carbonized into CIPBs, and removal of the PS templates resulted in a porous inverse opal structure. The CIPBs exhibited tunable structural colors due to Bragg diffraction of light, which varied by changing the lattice spacing d and viewing angle θ. These structural colors were further influenced by the refractive indices when the CIPBs were dispersed in various solvents, suggesting their potential use as colorimetric refractive index monitoring sensors. X-ray photoelectron spectroscopy and Fourier transform infrared spectroscopy analyses revealed the humin-like molecular structure of the CIPBs, which are rich in carbonyl and carboxyl functional groups as well as sp2 C = C bonds. These findings indicate that CIPB has both hydrophilic and hydrophobic natures, enabling good dispersibility in various organic solvents that can be utilized as printable photonic ink. Furthermore, CIPBs demonstrated pH-responsive color changes, attributed to the osmotic swelling of the inverse opal structure in different pH environments due to the presence of carboxyl groups within the CIPB backbone. The structural colors repeatedly changed between green at lower pH values and orange at higher pH values with outstanding reproducibility, indicating their potential for colorimetric chemical sensor applications.