'How can I change colors of complex SVG objects in Fabric.js?

I have some complex vector SVG objects with the same color theme. They are all individual objects. I want to change color themes of them. What is the easiest method of it? Can I change the colors based on id tags in SVG? (I'm open to other library suggestions)

Example of swapping color schemes of vector objects



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source