Hi,
I'm not sure if using ScalarMix is good choice for mixing colors.
Scalar is one particular value like float and color is more like vec3.
Not sure how it is casted in logic, but that for sure won't give you result you are expecting.
You can see that you are changing between types in visual shader by color of slots you connect. Purple one is vec3 while blue is scalar (like single float).