summaryrefslogtreecommitdiff
path: root/util/getLinkNodeColor.ts
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2022-09-27 15:09:17 +0200
committerThomas F. K. Jorna <[email protected]>2022-09-27 15:09:17 +0200
commita575d14b6621d5464d33d52ca642f2db70c3e370 (patch)
tree5a1d38227a93b1bf2b152ed4af5820a59c34cf91 /util/getLinkNodeColor.ts
parentfa84c052b221d157fa869cd4912acd538b5005a0 (diff)
fix: move a ton of functions to separate files
Diffstat (limited to 'util/getLinkNodeColor.ts')
-rw-r--r--util/getLinkNodeColor.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/util/getLinkNodeColor.ts b/util/getLinkNodeColor.ts
new file mode 100644
index 0000000..86cfa4b
--- /dev/null
+++ b/util/getLinkNodeColor.ts
@@ -0,0 +1,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 })
+}