diff --git a/frontend/app/card/card.charting.js b/frontend/app/card/card.charting.js
index c0a32d2fe23faf5f9275925f9f911142bfc839cc..67140ab4303a813a4fea19020b91f24ecdbcf7f9 100644
--- a/frontend/app/card/card.charting.js
+++ b/frontend/app/card/card.charting.js
@@ -777,9 +777,6 @@ export var CardRenderer = {
                     value: row[1]
                 };
             }),
-            keys = _.map(data, function(d) {
-                return d.key;
-            }),
             sumTotalValue = _.reduce(data, function(acc, d) {
                 return acc + d.value;
             }, 0);
@@ -798,13 +795,8 @@ export var CardRenderer = {
                         .dimension(dimension)
                         .group(group)
                         .colors(settings.pie.colors)
-                        .colorCalculator(function(d) {
-                            var index = _.indexOf(keys, d.key);
-                            return settings.pie.colors[index % settings.pie.colors.length];
-                        })
-                        .label(function(row) {
-                            return row.key == null ? '[unset]' : row.key;
-                        })
+                        .colorCalculator((d, i) => settings.pie.colors[((i * 5) + Math.floor(i / 5)) % settings.pie.colors.length])
+                        .label(row => row.key == null ? '[unset]' : row.key)
                         .title(function(d) {
                             // ghetto rounding to 1 decimal digit since Math.round() doesn't let
                             // you specify a precision and always rounds to int
diff --git a/frontend/app/card/card.services.js b/frontend/app/card/card.services.js
index b2e3a24e4f37502946e01691b36d14e4e6d9dc32..671b0112712f47e4f1f3eec3a18e0411ffe3da0f 100644
--- a/frontend/app/card/card.services.js
+++ b/frontend/app/card/card.services.js
@@ -1,6 +1,6 @@
 import _ from "underscore";
 
-import { harmony } from '../lib/colors'
+import { harmony } from 'metabase/lib/colors'
 
 // Card Services
 var CardServices = angular.module('metabase.card.services', ['ngResource', 'ngCookies']);
diff --git a/resources/frontend_client/app/lib/colors.js b/frontend/app/lib/colors.js
similarity index 100%
rename from resources/frontend_client/app/lib/colors.js
rename to frontend/app/lib/colors.js