### Synthesis of dye-sensitized monodisperse TiO_{2} microsphere

The synthesis of the monodisperse TiO_{2} microsphere was carried out by a modified sol-gel procedure^{48}. In a typical process, 0.28 g dodecylamine was dissolved in a mixture solution containing 0.12 ml of deionized water, 50 ml of acetonitrile and 100 ml of methanol. After stirring for 5 min, 1 ml of titanium (IV) isopropoxide was added to the transparent solution and further stirred for 12 h to obtain a suspension. The suspension was centrifuged, washed with ethanol and dispersed in 15 ml of ethanol. Supplementary Fig. 3 shows the scanning electron microscopy image of the as-prepared monodisperse TiO_{2} microsphere.

Commercial dyes SQ2 (5-carboxy-2-((3-((2,3-dihydro-1,1-dimethyl-3-ethyl-1*H*-benzo(e)indol-2-ylidene)methyl)-2-hydroxy-4-oxo-2-cyclobuten-1-ylidene)methyl)-3,3-dimethyl-1-octyl-3*H*-indolium, as received from Solaronix), LEG4 (3-(6-(4-(bis(2′,4′-dibutyloxybiphenyl-4-yl)amino-)phenyl)-4,4-dihexyl-cyclopenta-(2,1-b:3,4-b’)dithiophene-2-yl)-2-cyanoacrylic acid, as received from Dyenamo) and L0 (4-(diphenylamino) phenylcyanoacrylic acid, as received from Dyenamo) were used to stain the as-prepared TiO_{2} microsphere. The absorbance of these selected dyes was measured by ultraviolet-visible light spectroscopy, showing the distinctive absorbance (Supplementary Fig. 4). In a typical staining process, 5 ml of TiO_{2} suspension solution was centrifuged to remove the solvent and then dispersed in 5 ml fo saturated ethanolic solution of dye. The colloidal concentration can be measured by counting the number of colloids after several rounds of dilution. After 2 days of loading, the dye-sensitized TiO_{2} colloids were centrifuged and washed with ethanol to remove excess dye and redispersed in hydroquinone (100 mM) and benzoquinone (1 mM) aqueous solution with colloidal concentration of roughly 4 × 10^{11} per cm^{3}.

### Simulation of electric field and fluid flow

The particle–particle interaction is numerically simulated by the COMSOL Multiphysics package. To simulate the diffusiosmotic flow around the particle and the apparent pair potential, the interactions between the activated–passive particle pair and the activated–activated particle pair are considered. Generally, when the light with a certain wavelength is illuminated from the top, the particle is activated and the oxidation products are generated from the illuminated side. As light cannot penetrate through the particle, we only consider the illuminated hemisphere to be the oxidation reaction site, in which the chemical reaction involved is QH_{2} → BQ + 2H^{+} and the counter reduction reaction BQ + 2H_{2}O → QH_{2} + 2OH^{−} proceed at the shaded side. Owing to the different diffusion coefficients of H^{+} and OH^{−}, an uneven distribution of charged species will be produced, resulting in a local electric field. Such self-generated electric fields drive the motion of the charged species in the electrical double layer of both the particle surface and the substrate, producing a fluid flow that drags the particle.

To build the model, three different modules will be used. The diffusion of dilute species module is used to simulate the diffusion of H^{+} and OH^{−}, the electrostatic module is used to simulate the electric field that is generated by the competing diffusion between H^{+} and OH^{−}, and the fluid flow module is used to simulate the diffusio-osmotic flow generated by the movement of ions in electrical double layer. For the diffusion of dilute species, the distribution of H^{+} and OH^{−} can be affected by the diffusion, convection and electrophoresis under the electric field. Such behaviour can be fully described by the continuity equation at a steady state,

$${\rm{\nabla }}\,{{\bf{J}}}_{{\boldsymbol{i}}}=U\,{\rm{\nabla }}{{\bf{c}}}_{{\bf{i}}}-{{D}}_{{i}}{{\rm{\nabla }}}^{{\rm{2}}}{{\bf{c}}}_{{\bf{i}}}-\frac{{{\bf{z}}}_{{\bf{i}}}{\rm{F}}{{D}}_{{i}}{\rm{\nabla }}({{\bf{c}}}_{{\bf{i}}}{{\rm{\nabla }}}_{{\boldsymbol{\phi }}})}{{\rm{R}}{\rm{T}}}$$

(1)

where *J*_{i} is the flux of ion *i*, *U* is the fluidic velocity, *F* is the Faraday constant, *φ* is the electrostatic potential, *R* is the gas constant, *T* is the temperature and *c*_{i}, *D*_{i} and *z*_{i} are the concentration, diffusion coefficient and charge of species *i*, respectively. The electrostatic potential (\(E=-\nabla \phi \)) can be calculated from the Poisson equation,

$$-{\varepsilon }_{0}{\varepsilon }_{{\rm{r}}}{\nabla }^{2}\phi ={\rho }_{e}=F\left({Z}_{+}{c}_{+}+{Z}_{-}{c}_{-}\right)$$

(2)

where *ε*_{0} is the vacuum permittivity, *ε*_{r} is the relative permittivity of water, *ρ*_{e} is the charge density, *Z*_{+} and *c*_{+} are the charge and concentration of H^{+} ions, and \(Z{\rm{\_}}\) and *c*_{−} are the charge and concentration of OH^{−}.

The fluid flow outside the electric double layer is governed by two equations, the Stokes equation at steady state equation (3) and the continuity equation for the incompressible fluid equation (4), respectively.

$$-\nabla p+u{\nabla }^{2}U=0$$

(3)

$${\rm{\nabla }}\,{\bf{U}}={\bf{0}}$$

(4)

where *u*, *U* and *p* are the dynamic viscosity of water, velocity and pressure, respectively. The initial value of *U* and *p* are zero in our simulation.

The boundary condition on the activated particle is set to be the release or consumption of ions, representing the continuity of ion flux on the reaction hemisphere. On the reaction hemisphere, H^{+} and OH^{−} will both be released from the surface, so the flux of both species will be set as positive.

In the fluid flow module, the boundary condition of both the particle surface and the substrate is set to be the electro-osmotic boundary. Electro-osmotic flow is then dominated by the tangential component of the electric field,

$${E}_{{\rm{t}}}=E-(E-n)\,\bullet \,n$$

(5)

where *E*_{t} is the tangential component of the electric field strength *E*. The electro-osmotic velocity is then governed by

$${u}_{{\rm{p}}}=-\frac{{\varepsilon }_{{\rm{r}}}{\varepsilon }_{0}{\zeta }_{{\rm{p}}}}{\mu }{E}_{{\rm{t}}}$$

(6)

$${u}_{{\rm{sub}}}=-\frac{{\varepsilon }_{{\rm{r}}}{\varepsilon }_{0}{\zeta }_{{\rm{sub}}}}{\mu }{E}_{{\rm{t}}}$$

(7)

\({\zeta }_{{\rm{p}}}\), \({\zeta }_{{\rm{sub}}}\) here represent the zeta potential of the particle and the substrate, *u*_{p} and *u*_{sub} are the velocity of the electro-osmotic flow on the particle and the substrate, respectively.

Extended Data Fig. 7 shows the simulation results for activated–passive (above) and activated–activated (below). The concentration distribution of H^{+} is shown as an example of the transport of dilute species simulation. Together with the distribution of OH^{−}, the generated electric field is produced as shown in Extended Data Fig. 7b.

To calculate the apparent pair potential, we modify the model of Morse potential to be the sum of an attractive potential exerted by diffusio-osmotic flow and an electrostatic repulsion potential. The apparent attraction force exerted on the particle generated by total electro-osmotic flow is first calculated. We consider the attraction force *F*_{a}(*x*) as a function of separation distance *x*, so that the attraction potential \({u}_{{\rm{a}}}(x)\) can be calculated by performing an integration from the particle surface *x*_{0} to ∞,

$${u}_{{\rm{a}}}(x)=-{\int }_{{x}_{0}}^{{\rm{\infty }}}{F}_{{\rm{a}}}(x){\rm{d}}x$$

(8)

The attraction force at differential *x* can be calculated by performing a volumetric integration of the pressure *P* on the electric double layer. As our simulation is in 2D, the volumetric integration will become areal integration,

$${F}_{{\rm{a}}}(x)=\iint P{\rm{d}}x{\rm{d}}y$$

(9)

The integration area is an annular area around the particle representing the electric double layer with a thickness of 30 nm, which is estimated for an ionic concentration of 7 × 10^{−4} mol m^{−}^{3}. The result shows the total force exerted on a particle, we only consider the *x* component because the *y* component does not contribute to the attraction interaction. Attraction force on the *x* axis is calculated by *F* × cos (*θ*), where *θ* is the included angle between the *x* and *y* components of the velocity. The attraction force at different separation distances can be calculated by performing a parametric sweep in COMSOL. A potential can be plotted by performing integration on the curve in commercial package Origin with equation (8),

For the repulsion potential *u*_{r}(*x*), we adopted the equation of electrostatic repulsion between two charged spherical colloids with the Derjaguin approximation,

$${u}_{{\rm{r}}}(x)=\frac{{Q}^{2}}{4\pi {\varepsilon }_{0}{\varepsilon }_{{\rm{r}}}}{\left(\frac{{{\rm{e}}}^{-\kappa r}}{1+\kappa r}\right)}^{2}\frac{{{\rm{e}}}^{-\kappa x}}{x}$$

(10)

$$Q=4\pi {r}^{2}{\varepsilon }_{0}{\varepsilon }_{{\rm{r}}}\zeta \kappa $$

(11)

where *Q* is the surface charge, *κ* is the inversion of Debye length, *r* is the radius of the particle and *ζ* is the zeta potential of the particle.

The simulated apparent pair potential can thus be calculated by

$$w(x)={u}_{{\rm{a}}}(x)+{u}_{{\rm{r}}}(x)$$

(12)

### Measurement of the apparent pair potential

The area fraction *ϕ* occupied by the interfacial particles is defined as \(\varphi =\frac{N\pi {r}^{2}}{A}\). To measure the apparent pair potential, the as-prepared LEG4-loaded TiO_{2} and SQ2-loaded TiO_{2} were mixed with a ratio of 1:1, and diluted 3,000 times in QH2/BQ aqueous solution. Then the mixture solution was loaded into a wax-sealed capillary (Arte Glass Associates Co., Ltd, the path length is 100 μm), with area fraction *ϕ* ≅ 1%. The supercontinuum laser (SC-Pro, Wuhan Yangtze Soton Laser Co., Ltd) coupled with the variable linear filter was used as the light source. The dynamic interaction of the colloids was observed with Olympus BX51M optical microscope and recorded by a digital video camera (Canon EOS M50) at 1,920 × 1,080 resolution at 30 fps. As shown in Supplementary Fig. 5, the radial distribution function *g*(*r*) can be calculated from scores of statistical location information from the recorded data, according to the general expression equation (13)^{49,50,51}.

$$g(r)=\frac{2N(r)}{A{\rho }^{2}(2\pi r{\rm{d}}r)}$$

(13)

where *r* is separation distance, *N*(*r*) is the number of colloidal pairs at separation distance *r*, *N* is the total number of colloids in each frame, *A* is the area of the frame, *ρ* = *N/A* is the number density of the particles, 2*πr*d*r* is the bin area. In this binary mixture, α and β represent the two components. The equation (14) is derived to calculate the radial distribution function between species α and β, where the number of them is denoted as *N*_{α} and *N*_{β}, respectively.

$${g}_{{\alpha \beta }}\left(r\right)=\frac{A}{{N}_{{\alpha }}{N}_{{\beta }}} < \mathop{\sum }\limits_{i=1}^{{N}_{\alpha }}\mathop{\sum }\limits_{j=1}^{{N}_{\beta }}\delta \left(r-\left({r}_{i}-{r}_{j}\right)\right) > $$

(14)

With finite concentration, the radial distribution function can reflect the interaction between neighbouring colloids. Generally, the apparent pair potential (Supplementary Fig. 6) can be determined by equation (15):

$$w\left(r\right)=-{k}_{{\rm{B}}}T{\rm{ln}}g\left(r\right)$$

(15)

### Brownian dynamics simulation

Numerical fitting to the above apparent pair potential using homemade MATLAB codes was carried out to determine the particle–particle interaction potential and showed the standard Morse potential:

$$U\left(r\right)={D}_{0}\left[{{\rm{e}}}^{-2a\left(r-{r}_{0}\right)}-{2{\rm{e}}}^{-a\left(r-{r}_{0}\right)}\right]$$

(16)

where *D*_{0} is the depth of the potential well, *a* controls the ‘width’ of the potential and *r*_{0} is the equilibrium distance. The fitting parameters will be used to describe the corresponding particle–particle interactions in Brownian dynamics simulations.

The Brownian dynamics simulations were conducted using the LAMMPS package^{1}. The simulation system is 2D (6.0 × 6.0 μm^{2}) and consists of 2,178 active and 2,178 passive particles. Periodic boundary conditions are used in lateral directions. The cut-off distance is set to 5.0 μm. A standard velocity-Verlet integrator with a time step of 1.0 μs is adopted to integrate the equation of motion:

$$m\frac{\partial v}{\partial t}={F}_{{\rm{c}}}-\frac{m}{\tau }v+{F}_{{\rm{r}}}$$

(17)

where *m* is the particle mass, *v* is the particle velocity, *τ* ranging from 1.0 to 1,000.0 μs is the damping factor, *F*_{c} is the conservative force from the interparticle interactions and \({F}_{{\rm{r}}}\propto \sqrt{\frac{m{k}_{{\rm{B}}}T}{\tau {\rm{d}}t}}\) is the force due to solvent atoms at a temperature *T* randomly bumping into the particle. The interaction among particles is described using the Morse potential equation (16) with the obtained parameters. Active and passive particles of the same size were uniformly dispersed at the initial state. The system was first relaxed for 2.0 s under consideration of identical particles, that is, active and passive particles are considered the same. After that, the system reached an equilibrium state, in which both active and passive particles were uniformly distributed. Then the system was run for 2.0 s (2 × 10^{6} time steps) using various interparticle interactions in Supplementary Table 1.

### Determination of Brownian dynamics of TiO_{2} particles under light illumination

The SQ2 sensitized TiO_{2} colloid was selected to illustrate the influence of light intensity on the mean squared displacement (MSD). The experiment process was similar to the measurement of pair potential, with decreased area fraction *ϕ* of 0.5%. The MSD under various red light intensities (10, 30, 50, 70 and 90 mW cm^{−}^{2}) was then calculated using homemade MATLAB codes. As shown in Extended Data Fig. 1, the intensity of light had negligible effect on the MSD.

### 2D phase separation and coarsening of binary mixture

To study the phase behaviour of binary mixture, first a well-mixed solution of as-prepared LEG4-loaded-TiO_{2} and SQ2-loaded-TiO_{2} with a 1:1 ratio was diluted 200 times in QH2/BQ aqueous solution. Then it was sealed into a rectangle capillary and rested for 2 min to make sure all suspending colloid precipitated on the bottom surface with a roughly 15% area fraction.

To investigate the influence of light intensity on phase kinetics, red light with various intensities (640–660 nm; 10, 30, 50 and 90 mW cm^{−}^{2}) was illuminated on the binary mixture solution from the top, with weak white backlight. In our definition, cluster was determined by connecting all particles with centre-to-centre separation smaller than 1.5 particle diameter, and the cluster size was averaged over all clusters in the field of view. Then the gas fraction, the percentage of isolated colloids in all colloids, was calculated. The method was also applied to the Brownian dynamics simulation of phase evolution. As shown in Extended Data Fig. 8, the simulated phase segregation result matched well with the experiment (Fig. 3) except for the growth exponent at high illumination intensity, in which the simulated growth exponent was 0.85 compared to 0.54 in the experiment. This deviation may be attributed to the inaccurate potential of applied Morse potential, which is accurate in long range, but less accurate in the short range for describing particle–particle interaction. In high illumination, the particle–particle distance is small, which manifests this potential inaccuracy, and the growth exponents discrepancy is observed.

Furthermore, uniform light with various red-to-blue ratios (40:0, 30:10, 20:20, 10:30 and 0:40 mW cm^{−}^{2}) was illuminated to the binary solution to further study the effect of incident light spectrum on the phase segregation. As shown in Fig. 4a, the various illumination spectra result in various intensities of segregation, which is defined by the following equation:

$$I=\frac{{N}_{{\rm{AA}}}+{N}_{{\rm{BB}}}}{{N}_{{\rm{AA}}}+{N}_{{\rm{BB}}}+{N}_{{\rm{AB}}}}$$

(18)

For simplicity, the two components in the binary mixture are denoted as A and B, where *N*_{AA}, *N*_{BB} and *N*_{AB} represent the number of pairs for every particle’s nearest three neighbouring particles.

In a ternary system, L0 sensitized TiO_{2} colloids were introduced to offer a third colour channel. The area fraction of the ternary mixture was also tuned to 15%. The ternary phase segregation was also observed under top blue, green and red light illumination with fixed intensity (50 mW cm^{−}^{2}). Obvious segregation appeared under about 2 min of top light illumination.

To quantitatively characterize the self-similarity during the phase segregation process, the chord length distribution function^{43,52}, \(P(l/\langle l\rangle )\), was measured for a different temporal snapshot. Briefly, a straight line was randomly generated across a snapshot. The chord length *l* was then determined by the length of the line segment inside the cluster. By varying the starting point and the orientation of the straight line randomly, a series of *l* values from different straight lines was obtained and then normalized by the mean value (characteristic length) <*l*>, from which the chord length distribution function \(P(l/\langle l\rangle )\) was yielded.

As shown in Extended Data Fig. 2. The chord length distribution functions are independent of time, indicating a self-similar growth mechanism, which is also the origin of the power-law dependence and very similar to the phase separation in a classical thermodynamic mixture.

### 3D phase segregation

To study the vertical phase segregation of the ternary colloidal system, the 3D particle distribution was mapped by optical microscope and confocal laser scanning microscope (LEICA TCS SP8), respectively. Specifically, a colloidal mixture solution of L0, LEG4 and SQ2-loaded TiO_{2} (the ratio for them was 1:1:1) was sealed into a parallel plated glass cell separated with parafilm (*ϕ* ≅ 100%). Then the cell was exposed to the blue, green and red light (Supplementary Fig. 1a) in turn, and illuminated from the top with a fixed intensity (100 mW cm^{−}^{2}). The optical microscope (the magnification and numerical aperture of the objective were ×40 and 0.9, respectively) was focused at different depths (*Z* = 0 to 80 μm), and the distribution of varying colour colloids at each depth layer was tracked. As shown in Supplementary Fig. 1b and Supplementary Video 4, the active SQ2-loaded colloids aggregated at the bottom under red light illumination, while passive L0 and LEG4-loaded colloids were pushed to the top. Conversely, under green and blue light top illumination (Supplementary Video 4), the active and passive couples were switched to LEG4/(SQ2+L0) and (L0+LEG4)/SQ2, respectively (Supplementary Table 3).

This light-inducing vertical segregation can also be visualized with a confocal microscope (Fig. 5b). Experimentally, the ternary mixture solution sealed in the homemade cell was placed under the inverted confocal microscope and exposed to blue, green and red light illumination from the top, in turn, at a fixed intensity (100 mW cm^{−}^{2}). After about 2 min of illumination, the 3D confocal images were captured in which the fluorescence signals of SQ2, LEG4 and L0 were set as cyan, magenta, and yellow, respectively.

### 3D simulation of the phase segregation

To simulate the 3D phase segregation, COMSOL Multiphysics was used to simulate the detailed flow field in the particle matrix, while all the particles’ top parts received higher light intensity than the bottom due to scattering and shadowing of the particle matrix. As shown in Extended Data Fig. 3a, on illumination, a vertical flow was generated between particles by diffusiophoresis, which was the origin of the attractive potential. Under this attractive potential, active particles clustered together and the vertical flows overlapped with each other and intensified (Extended Data Fig. 3b).

In the 3D phase separation experiment, there were roughly 30–50 layers of particles in the colloidal solution, and the lower particles served as the pseudo-substrate for the upper layers. As shown in simulation (Extended Data Fig. 3c), when passive particles (blue) settled below a layer of active particles (red), the upwards electro-osmotic flow was generated similarly to the particle monolayer. As more layers of active particles stacked, the upwards flow increased, which brought passive particles to the top, while the active particles made a sediment at the bottom due to the counteraction of the upwards fluid flow generation (Extended Data Fig. 3d,e).

We further explain this 3D layering process in crowded conditions with 3D Brownian dynamics simulations, where the light-dependent Morse potential, \(u={D}_{0}\left[{{\rm{e}}}^{-2\alpha \left(r-{r}_{0}\right)}-2{{\rm{e}}}^{-\alpha \left(r-{r}_{0}\right)}\right]\) describing the particle interaction and the light-dependent vertical force describing the upwards flow field is adopted. Here, the parameters of potential function, that is, the depth of the potential well *D*_{0} and \(\alpha \) controlling the ‘width’ of the potential, were obtained from fitting the apparent pair potentials, as measured in our experiment (Fig. 2). Besides, according to the experimental observation and former diffusiophoresis simulations, a vertical force that varied with the average vertical distance *h* was added, and the magnitudes of imposed vertical forces applied on the two distinct particles were proportional to the particle activity. Initially, it was assumed that active and passive particles were uniformly distributed in the simulated domain. A 3D simulation with constant temperature, volume and number of particles (*N*, *V* and *T*) was then carried out. As shown in Extended Data Fig. 3f, active and passive particles spontaneously separated under the light illumination, which is consistent with our experimental observation.

### Macroscopic photochromic ink and characterization

To formulate the photochromic colloidal swarm ink, the as-prepared L0-loaded-TiO_{2}, LEG4-loaded-TiO_{2} and SQ2-loaded-TiO_{2} solutions were mixed at a 1:2:1 ratio (Supplementary Fig. 2a). A commercial 3LCD projector was chosen to project designed colour textures onto the as-prepared colloidal swarm ink. To obtain pure blue, green and red light, three optical filters were placed between the dichroic combiner cube and the original RGB light source to narrow the default broader output wavelength range for non-overlapping output (Supplementary Fig. 2b,c). To project high-resolution image, the projector lens was inverted.

In the macroscopic imaging demonstration, the colloidal swarm ink was injected into a parallel plate glass cell separated with parafilm, while the designed textures were projected onto the ink and exposed for 120 s. The obtained colour images were recorded with a digital camera (Canon EOS M50). The colour gamut was measured to characterize the performance of the photochromic ink. First, a series of images were obtained by projecting six colour blocks (Fig. 5d) with different times and intensities. Then all the samples were placed under the pinhole of the integrating sphere, and the simulated sunlight was illuminated into the integrating sphere. The spectrometer and commercial software (Oceanview) were used to draw the received reflected light spectrum into the colour gamut diagram (polytetrafluoroethylene is selected as a white Lambertian diffuser).

### Particle size dependence of photochromic ink performance

To study the influence of the particle size on the photochromic performance of the active ink, we investigated the photochromic performance of colloidal swarm with 500 nm, 1 μm and 2 μm TiO_{2} particles, respectively. As shown in Extended Data Fig. 4, smaller particles resulted in much-enhanced photosensitivity, in which the brightness and contrast of the resulting image improved, whereas the larger particles showed much deteriorated image quality. To quantify the photosensitivity, characteristic curves of colloidal swarms with 500 nm, 1 μm and 2 μm TiO_{2} were measured and plotted as contrast versus light intensity and contrast versus exposure time. From the characteristic curves, we concluded that the minimum light intensity and exposure time were 20 mW cm^{−}^{2} and 1 min, respectively.

We speculate that the photosensitivity is determined by the balance of upwards flow generated by active particles and the gravity of passive particles. As a result, the photosensitivity is not fundamentally limited by the working mechanism. Instead, lower density particles (such as high porosity TiO_{2} (ref. ^{53}) or polystyrene-TiO_{2} core-shell particles^{54}) with less gravitational drag may further enhance colloidal swarm photosensitivity. In addition, new photosensitive dyes with high absorption coefficients or better dye loading strategies, such as shown in recent publication^{47} may also enhance the photochromic performance of colloidal swarm.

### Performance of the photochromic ink with different particle concentrations

Owing to thermal fluctuation, the colloidal swarm behaves as a liquid in which interstitial space allows the particle rearrangement for segregation. On the other hand, this interstitial space shrinks as particle density decreases, which prevents the segregation process. As shown in Extended Data Fig. 5, the segregation is observed in diluted ink, while the image contrast is not high as there are insufficient particles in the swarm. The colloidal swarm image quality gradually improves with particle concentration and an optimal concentration is achieved at 1 × 10^{12} per cm^{3}. Further increasing particle concentration leads to deteriorated contrast and brightness, suggesting incomplete segregation.

### Performance of the photochromic ink with different zeta potentials

As the colour image of the photochromic ink is a result of phase segregation, the response can be easily tuned with simple surface modification or doped with different dyes. As shown in Extended Data Fig. 6 and Supplementary Table 4, a negative colour image is achieved with positively charged particles instead of positive colour images for negatively charged particles.

We also compared the key features of current available photochromic materials, which are mainly based on the valence transition in material or photoisomerization of chromophore molecules. As shown in Supplementary Table 5, the performance of our colloidal swarm ink offers full-colour rendering ability and immediate repatterning ability with high sensitivity and response speed^{55,56,57,58,59,60}.