You can save the source with another attribute via JavaScript, such as data-src
, when theme changing, then re-render the diagram from data-src
, this approach would be friendly for UE.
It depends on how you implement the theming, the following references may help.