diff --git a/frontend/src/lib/components/graph/FlowGraph.svelte b/frontend/src/lib/components/graph/FlowGraph.svelte index 613d008383..04cd790bcd 100644 --- a/frontend/src/lib/components/graph/FlowGraph.svelte +++ b/frontend/src/lib/components/graph/FlowGraph.svelte @@ -185,7 +185,8 @@ id: `dep-${pid}-${$selectedId}`, source: pid, target: $selectedId!, - labelBgColor: 'white', + labelBgColor: darkMode ? '#999' : 'white', + edgeColor: darkMode ? 'white' : 'black', arrow: false, animate: true, noHandle: true, @@ -201,7 +202,8 @@ id: `dep-${pid}-${$selectedId}`, source: $selectedId!, target: pid, - labelBgColor: 'white', + labelBgColor: darkMode ? '#999' : 'white', + edgeColor: darkMode ? 'white' : 'black', arrow: false, animate: true, noHandle: true, @@ -770,9 +772,11 @@ onMount(() => { onThemeChange() }) + + let darkMode = false - +
- import type { EdgeTextProps } from './types'; + import type { EdgeTextProps } from './types' - // destructuring props to pass into BaseEdge component - export let edgeTextProps: EdgeTextProps; - $: ({ label, labelBgColor, labelTextColor, centerX, centerY } = - edgeTextProps); + // destructuring props to pass into BaseEdge component + export let edgeTextProps: EdgeTextProps + $: ({ label, labelBgColor, labelTextColor, centerX, centerY } = edgeTextProps) - const shiftRectY: number = 7; - $: pxRatio = label.length < 3 ? 9 : 7; + const shiftRectY: number = 7 + $: pxRatio = label.length < 3 ? 9 : 7 - // determine the center point of the edge to be used in the EdgeText component - $: textCenterX = centerX; - $: textCenterY = centerY; + // determine the center point of the edge to be used in the EdgeText component + $: textCenterX = centerX + $: textCenterY = centerY - // determine width of rect to render based on label.length (removing spaces) - // pxRatio is an estimate of how many pixels 1 character might take up - // pxRatio not 100% accurate as font is not monospace - $: spaces = label.split(' ').length - 1; - $: newLength = label.length - spaces; - $: labelPx = newLength * pxRatio; + // determine width of rect to render based on label.length (removing spaces) + // pxRatio is an estimate of how many pixels 1 character might take up + // pxRatio not 100% accurate as font is not monospace + $: spaces = label.split(' ').length - 1 + $: newLength = label.length - spaces + $: labelPx = newLength * pxRatio {#if typeof label === 'undefined' || !label} - {null} + {null} {:else} - - - - {label} - - + + + + {label} + + {/if}