diff --git a/src/visualizations/treeview/Treeview.ts b/src/visualizations/treeview/Treeview.ts index b8b811a..f39f9af 100644 --- a/src/visualizations/treeview/Treeview.ts +++ b/src/visualizations/treeview/Treeview.ts @@ -111,7 +111,7 @@ export default class Treeview { this.root.data.setSelected(true); const updateColor = (d: HPN, level: number) => { - d.data.setColor(this.settings.colorProvider(d.data)); + d.data.setColor(this.settings.colorProvider(d.data, level)); if (level < this.settings.colorProviderLevels && d.children) { for (const child of d.children) { updateColor(child, level + 1); diff --git a/src/visualizations/treeview/TreeviewSettings.ts b/src/visualizations/treeview/TreeviewSettings.ts index 0b0977b..7bdde1c 100644 --- a/src/visualizations/treeview/TreeviewSettings.ts +++ b/src/visualizations/treeview/TreeviewSettings.ts @@ -108,9 +108,10 @@ export default class TreeviewSettings extends Settings { * nodes up until the level in the tree specified by the parameter "colorProviderLevels". * * @param d A TreeviewNode for which the corresponding color should be computed. + * @param level The depth in the tree at which this node is situated. * @return The color associated with the given node. */ - colorProvider: (d: TreeviewNode) => string = (d: TreeviewNode) => defaultColorScale(d.name); + colorProvider: (d: TreeviewNode, level?: number) => string = (d: TreeviewNode) => defaultColorScale(d.name); /** * Returns the label that should be displayed for a specific node (the label corresponds to the text shown in the