Apex Chart help needed

The chart color and legend color are not matching as you see here and here is my code

 withChart(ChartBuilder.get().withType(Type.PIE).build())
                .withLabels("Successes", "Failures")
                .withLegend(LegendBuilder.get()
                        .withPosition(Position.RIGHT)
                        .build())
                .withSeries(series.toArray(new Double[0]))
                .withColors("green","red")
                .build()
```. 
Unable to find any example which fixes above issue
![image.png|2731x1349](upload://xHD8epXI4byf04YGB7byyYJ6uO6.png)

What does your series data look like?