Dynamically alter multiple meshes color with one THREE.Color?

I’m trying to have my scene dark mode compatible. I have set an interval timer to check is dark mode had been enabled and it then changes a javascript object which contains several THREE.colors which I use throughout my scene on multiple meshes. When triggered, I change the THREE.Colors with .set() the color updates but doesn’t effect the mesh materials who use that THREE.Color. Are the meshes and the THREE.Color in their .color property not dynamically linked? is there a specific way to update so that the color change propagates to all meshes the use it in the scene?

Would greatly appreciate any help to know if this is possible.
Merry Christmas!

Could you share your code? The .color properties could be shared, but it depends how you created the materials. Passing the same Color instance to the constructors wouldn’t do it, I don’t think. Try material.color = color instead. Or you could just update the colors on each material with color.copy( refColor ).

merry christmas! :slight_smile:

3 Likes

Yes thank you. I’ve run into the problem of the constructor not following original inputs before… it’s a sneaky problem. Really appreciate the help