Colored slimes are hostile slime variants that were first added in Java version 1.17 - the "Adventurer's Update". They are identical to normal slimes in stats and behavior, but different in appearance and spawning location. As the name suggests, colored slimes are like normal slimes, but come in different colors.
Colored slimes spawn in slime chunks throughout the overworld, below 40 blocks on the Y axis. Colored slimes do not spawn in swamps like regular slimes (though will still spawn in slime chunks that happen to be in swamps). Colored slimes will also spawn in slime cave structures in great number.
They can only spawn on solid blocks, slime blocks, or ontop of slime.