Skip to content

Commit 70bb2aa

Browse files
committed
find all branches to color, not just immediate parents
1 parent e1e3b63 commit 70bb2aa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,21 +405,27 @@ function findNodeColor(node, colorOptions) {
405405
*/
406406
function findBranchColor(link, colorOptions) {
407407
if (colorOptions.branchColorMode === "none") {
408-
return colorOptions.defaultBranchColor ?? "#ccc";
408+
// light gray
409+
return colorOptions.defaultBranchColor ?? "#cccccc";
409410
}
410411

411412
let source = link.source;
412-
let children = source.children;
413+
//let children = source.children;
414+
let childLeafNodes = getAllLeaves(source);
413415

414-
let allChildrenInNodeList = children.every(child =>
416+
//let allChildrenInNodeList = children.every(child =>
417+
// colorOptions.nodeList?.includes(child.data._guid)
418+
//);
419+
let allChildLeafNodesInNodeList = childLeafNodes.every(child =>
415420
colorOptions.nodeList?.includes(child.data._guid)
416421
);
417422

418-
if (allChildrenInNodeList) {
423+
if (allChildLeafNodesInNodeList) {
424+
// yellowish
419425
return colorOptions.highlightColor ?? "#feb640";
420426
}
421427

422-
return colorOptions.defaultBranchColor ?? "#ccc";
428+
return colorOptions.defaultBranchColor ?? "#cccccc";
423429
}
424430

425431
/**

0 commit comments

Comments
 (0)