diff --git a/src/main/resources/vue/components/_charts.vue b/src/main/resources/vue/components/_charts.vue index 159af66..0e7164f 100644 --- a/src/main/resources/vue/components/_charts.vue +++ b/src/main/resources/vue/components/_charts.vue @@ -97,13 +97,10 @@ }); function createColorArray(length) { - const colors = ["#54ca76", "#f5c452", "#f2637f", "#9261f3", "#31a4e6", "#55cbcb"]; - let array = [...Array(length).keys()].map(i => colors[i % colors.length]); - // avoid first and last colors being the same - if (length % colors.length === 1) { - array[length - 1] = colors[1]; - } - return array; + // golden-angle hue steps spread colors evenly around the wheel, + // so no two colors land close together, no matter how many languages there are + const GOLDEN_ANGLE = 137.508; + return [...Array(length).keys()].map(i => `hsl(${(i * GOLDEN_ANGLE) % 360}, 65%, 55%)`); } function arrayRotate(arr, n) {