The Rainbow Slime is a very rare Hardmodeslime that spawns in The Hallow while it's raining. It constantly changes color, as do the Rainbow Bricks it drops.
The Rainbow Slime requires unique spawning conditions. It will only spawn when the player is physically within a hallowed biome, but it cannot spawn on hallowed blocks. This makes the finding of a Rainbow Slime best in a hallowed snow biome, as Snow Blocks cannot become hallowed. These conditions make it a somewhat rare enemy. The Rainbow Slime is immune to the Poisoned and Venom debuffs.
It is one of the few enemies that can be detected by the Lifeform Analyzer.
There is a greater likelihood that it will spawn when it rains and there is a Blood Moon currently active.
Tips
One way to encounter Rainbow Slimes in the hallowed forest biome is to set up a Water Candle inside the edge of the hallowed biome and wait at this location until it rains, allowing enemies to spawn off screen on non-hallowed blocks. Alternatively, hallowed blocks can be covered with snow or bricks of some kind to allow Rainbow Slimes to spawn, though this will prevent other Hallow enemies from spawning.
Another way is to place about 200 blocks of Pearlstone, Pearlsand, or pink ice above forest surface and wait for the rain with the Water Candle and Battle Potion ready. To avoid Forest transformation to Hallow, proper spacing is required.
Rainbow Slimes are also able to spawn on platforms, meaning that if you make a large setup using them, you have a high likelihood of discovering one.
The platforms must build up to outside the frame, as enemies normally cannot spawn on the same frame as the player.