Skip to content
Snippets Groups Projects
utils.ts 404 B
Newer Older
import { visualizationColors } from 'config';

export function nodeColorHex(num: number) {
  const colorVal = visualizationColors.GPCat.colors[14][num % visualizationColors.GPCat.colors[14].length];
  const hex = colorVal.replace(/^#/, '');
  const r = parseInt(hex.substring(0, 2), 16);
  const g = parseInt(hex.substring(2, 4), 16);
  const b = parseInt(hex.substring(4, 6), 16);
  return [r, g, b];
}