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())); }