You should be able to add something like the following to set the color on the fluid:
vector $rgb = rgbPP;
setFluidAttr -at “color” -vv ($rgb.x) ($rgb.y) ($rgb.z) -xi $xi -yi $yi fluidTexture2DShape1;
Color is a 3 channel value so needs to be set as a vector value(vv). Also you probably don’t want to do an add like the density set did… this just sets the color. If you wanted to do some kind of softness to the emission you could do things like use getFluidAttr to get the currently color value then blend in the particle color with that before setting it.
In terms of the colorInput attribute on nParticles the way these ramp attributes work is that there is an equivalent internalColorRamp output attribute on the nParticleShape. When one sets the input to something other than OFF (or the case of the color CONSTANT) then it automatically creates the per particle attribute like rgbPP, opacityPP, etc and connects from this rampOutput to that attribute. These graph connections are sort of hidden in that they are between attributes on the same node. If you want to set rgbPP in an expression it will already have a connection from the color ramp output( if one has the color input set to something like age), so you won’t be able to set it. Also if you set the input to Constant it then breaks the connection and deletes the rgbPP attribute( so you need to create it by hand again to set in an expression ).
Sorry if this is confusing. Note that it is possible to actually combine the ramp outputs with expressions if desired. Lets say you are currently using the age input for the color ramp. If you break the connection from the internalColorRamp to the rgbPP (you can right mouse over it under per particle attrs in the attribute editor for the nParticleShape and break the connection), you can then use the internalColorRamp inside the expression, similar to using other particle attributes. So you could for example multiply the ramp value by 2 in your expression(or by some user attribute) before setting rgbPP from it. You could also use the ramp this way to drive something other than rgbPP, like velocity.