(value, colors = defaultColors)
| 77 | |
| 78 | export |
| 79 | function getRandomColor(value, colors = defaultColors) |
| 80 | { |
| 81 | // if no value is passed, always return transparent color otherwise |
| 82 | // a rerender would show a new color which would will |
| 83 | // give strange effects when an interface is loading |
| 84 | // and gets rerendered a few consequent times |
| 85 | if(!value) |
| 86 | return 'transparent'; |
| 87 | |
| 88 | // value based random color index |
| 89 | // the reason we don't just use a random number is to make sure that |
| 90 | // a certain value will always get the same color assigned given |
| 91 | // a fixed set of colors |
| 92 | const colorIndex = _stringAsciiPRNG(value, colors.length); |
| 93 | return colors[colorIndex]; |
| 94 | } |
| 95 | |
| 96 | export |
| 97 | function parseSize(size) { |
no test coverage detected
searching dependent graphs…