Newer
Older
import { visualizationColors } from 'config';
import { NodeType } from '../nodelinkvis/types';
import { GeoJsonType } from './mapvis.types';
import { SearchResultType } from './mapvis.types';
export function nodeColorRGB(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];
}
export const isGeoJsonType = (data: NodeType | GeoJsonType | SearchResultType): data is GeoJsonType => {
return (data as GeoJsonType).properties !== undefined;
};