Sid
If you have a high resolution fluid with no turbulence and high detail solve plus perhaps a little viscosity then the simulation will diffuse less which would result in less color mixing. Increasing the solver quality might also help a little. You might try emitting color with a separate slightly larger emitter(than the density emitter) with no dropoff so there is less bleed in from the initial color( grey by default, but you could set state on it ). Note that auto resize initializes colors as the grid expands to black, not grey. You may prefer auto resize off.
Another trick that could be useful in some situations… If one enables the texture coordinate grid then the texture will be pushed around. The texture will contort and stretch but never mix. The fluid example “windTunnelTextured.ma” uses this technique. However it is more like having an initial state then pushing it around. If your emitters are continuously emitting or moving then it would be harder to make work. In the windTunnel example it uses the internal noise texture as a color map, but one could apply an external texture of the color and use volume samples override on the fluid. The placement of the texture could be indexed using the outUVW of a fluid, but it would need to be a fluid texture node. It would be a tricky setup. One could perhaps emit into a 3d fluid texture and use it as the color map with another fluid texture used for the coordinates for the color map fluid texture( this is a rather scary setup though).
Another thought might be to simply threshold the hue values in post. One could perhaps also rig up a little shading network on the fluid outColor value to accomplish this thresholding based on hue directly as part of the shader. I’ve not tried it, but something like… outColor->rgb to hsv->remap value where the remap value adjusts the hue and that plugs into an hsv to rgb (the s and v directly connected from the rgbToHsv) which goes into a volumeShader node which is connected to the shading engine (the original fluid would not be directly connected to the shading engine, but rather through a network. The volume shader node is the volume equivalent of the surface shader node which is simply a do nothing node that the shading engine can recognize as producing a color and transparency for rendering)
Duncan
I’ve attached a simple fluid file that uses the shader network I described using hsv and remap value nodes. One might additionally remap the saturation component to keep the color from greying. Or instead one could modify this network by plugging the outColor of the remap value node directly into the volumeShader color then setting the color ramp on the remap value to the desired set of colors using no interpolation. (no hsvToColor node needed)
Hopefully small attachments work on this list.
Duncan