public static Color toSWTColor(Element element, String attributeName) { Document document = element.getOwnerDocument(); ViewCSS viewCSS = (ViewCSS) document.getDocumentElement(); CSSStyleDeclaration computedStyle = viewCSS.getComputedStyle(element, null); SVGPaint svgPaint = (SVGPaint) computedStyle.getPropertyCSSValue(attributeName); if (svgPaint.getPaintType() == SVGPaint.SVG_PAINTTYPE_RGBCOLOR) { RGBColor rgb = svgPaint.getRGBColor(); float red = rgb.getRed().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE); float green = rgb.getGreen().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE); float blue = rgb.getBlue().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE); return SWTResourceManager.getColor((int) red, (int) green, (int) blue); } return null; }