With SVG Salamander:
Get the diagram from the cache and call a recursive search and replace:
SVGDiagram diagram = SVGCache.getSVGUniverse().getDiagram(uri);
setStroke(Color.BLACK, getHexString(Color.GREEN), diagram.getRoot());
Code for the functions:
private void setStroke(Color fromColor, String toColor, SVGElement node) throws SVGException {
if (node.hasAttribute("stroke", AnimationElement.AT_CSS)) {
StyleAttribute abs = node.getStyleAbsolute("stroke");
Color was = abs.getColorValue();
if (was.equals(fromColor)) {
abs.setStringValue(toColor);
}
}
for (int i = 0; i < node.getNumChildren(); ++i) {
setStroke(fromColor, toColor, node.getChild(i));
}
}
private String getHexString(Color color) {
return String.format("#%06x", (0xFFFFFF & color.getRGB()));
}