Rule rule = (Rule) data;
Symbolizer[] symb = rule.getSymbolizers();
if (symb.length == 1) { //we're only expecting 1
if (symb[0] instanceof PolygonSymbolizer) {
PolygonSymbolizer ps = (PolygonSymbolizer) symb[0];
Fill fill = ps.getFill();
oldColorExpr = fill.getColor();
fill.setColor(newColorExpr);
}else if (symb[0] instanceof PointSymbolizer) {
PointSymbolizer ps = (PointSymbolizer) symb[0];
Mark[] marks = ps.getGraphic().getMarks();
if(marks!=null && marks.length>0){
oldColorExpr = marks[0].getFill().getColor();