private getLinkColor()

in src/visual.ts [305:328]


    private getLinkColor(
        link: ForceGraphLink,
        colorPalette: IColorPalette,
        colorHelper: ColorHelper,
    ): string {
        if (colorHelper.isHighContrast) {
            return colorHelper.getThemeColor("foreground");
        }

        switch (this.settings.links.colorLink) {
            case LinkColorType.ByWeight: {
                return colorPalette
                    .getColor(this.scale1to10(link.weight).toString())
                    .value;
            }
            case LinkColorType.ByLinkType: {
                return link.linkType && this.data.linkTypes[link.linkType]
                    ? this.data.linkTypes[link.linkType].color
                    : ForceGraph.DefaultLinkColor;
            }
        }

        return ForceGraph.DefaultLinkColor;
    }