Every particle talks to neighbors. Initially I just made different fluid types transform directly on contact. It created "boundary layers", looked cool, but was completely unsuable for gameplay purposes. So I wanted the whole volume to change after contact with a single particle of different type. When one transformation happens on contact of two types of goo it sets global target transformation type and then all particles in contact with particles that recently transformed convert to this target color. This creates some wierdness, but it prevented goo being stuck in flickering cycle of endless transformations and was good enough for a jam.