79155949

Date: 2024-11-04 15:07:21
Score: 1
Natty:
Report link

Here is how i managed to set default pin & stroke (link) colors by type

   * Initializes the graph and canvas.
   * @param canvasElement - The HTMLCanvasElement to initialize LiteGraphCanvas with.
   */
  const initializeGraph = (canvasElement: HTMLCanvasElement): void => {
    const customLinkTypeColors = {
        integer: "#d2ffb0",
        string: "#f3b0ff",
        boolean: "#F77",
        float: "#b0e0ff",
        column: "#fffdb0"
    };
    
    graph.value = new LGraph()
    graphCanvas.value = new LGraphCanvas(canvasElement, graph.value)

    graphCanvas.value.default_connection_color_byType  = customLinkTypeColors
    graphCanvas.value.default_connection_color_byTypeOff  = customLinkTypeColors

    Object.assign(LGraphCanvas.link_type_colors, customLinkTypeColors);

    graph.value.start()
  }

And the result: enter image description here

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Iakov Belkov