summaryrefslogtreecommitdiff
path: root/util/getLinkNodeColor.ts
blob: 86cfa4bad8c746ea14b3d74458e53c4fc96c3d1a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { initialColoring, initialVisuals } from '../components/config'
import { LinksByNodeId } from '../pages'
import { getNodeColorById } from './getNodeColorById'

export const getLinkNodeColor = ({
  sourceId,
  targetId,
  linksByNodeId,
  visuals,
  coloring,
  cluster,
}: {
  sourceId: string
  targetId: string
  linksByNodeId: LinksByNodeId
  visuals: typeof initialVisuals
  coloring: typeof initialColoring
  cluster: any
}) => {
  return linksByNodeId[sourceId]!.length > linksByNodeId[targetId]!.length
    ? getNodeColorById({ id: sourceId, linksByNodeId, visuals, cluster, coloring })
    : getNodeColorById({ id: targetId, visuals, linksByNodeId, cluster, coloring })
}