diff --git a/client/app/scripts/mixins/node-color-mixin.js b/client/app/scripts/mixins/node-color-mixin.js index 51f958ba0..1e88b9dbd 100644 --- a/client/app/scripts/mixins/node-color-mixin.js +++ b/client/app/scripts/mixins/node-color-mixin.js @@ -1,8 +1,10 @@ const d3 = require('d3'); const PSEUDO_COLOR = '#b1b1cb'; -const hueScale = d3.scale.linear().range([0, 359]); -const lightnessScale = d3.scale.linear().domain([0, 359]).range([0.3, 0.7]); +const hueRange = [20, 330]; // exclude red +const hueScale = d3.scale.linear().range(hueRange); +// map hues to lightness +const lightnessScale = d3.scale.linear().domain(hueRange).range([0.3, 0.7]); const startLetterRange = 'A'.charCodeAt(); const endLetterRange = 'Z'.charCodeAt(); const letterRange = endLetterRange - startLetterRange; @@ -23,8 +25,12 @@ function text2degree(text) { } function colors(text, secondText) { - const hue = text2degree(text); - const saturation = 0.8; + let hue = text2degree(text); + // skip green and shift to the end of the color wheel + if (hue > 70 && hue < 150) { + hue += 80; + } + const saturation = 0.7; let lightness = 0.5; if (secondText) { // reuse text2degree and feed degree to lightness scale