> advertise a technical SVG standard that icon designers can comply with
> Then, the JS library would simply implement the ability to change colors assuming the icon follows the SVG standard
No need for JS for styling: just use CSS custom variables. The only thing that needs to be standardized are the two variable names.
Just define an icon like this:
icons.svg
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="calculator" viewBox="0 0 48 48">
<path class="icon-primary" style="fill: var(--icon-primary-color, black)" d="..."></path>
<path class="icon-accent" style="fill: var(--icon-accent-color, gray)" d="..."></path>
</symbol>
</svg>
Then use it like this: <style>
.icon {
--icon-primary-color: DarkBlue;
--icon-accent-color: DeepSkyBlue;
}
</style>
<svg class="icon"><use xlink:href="icons.svg#calculator"></use></svg>
See a demo here:
https://glitch.com/edit/#!/piquant-ladybug?path=index.html:1...