22
33import type { CSSProperties } from 'react' ;
44import { useReducedMotion } from 'motion/react' ;
5+ import { useTheme } from 'next-themes' ;
56import {
67 BaseEdge ,
78 EdgeLabelRenderer ,
@@ -43,6 +44,8 @@ export function LabelEdge({
4344 animated,
4445} : EdgeProps ) {
4546 const prefersReduced = useReducedMotion ( ) ;
47+ const { resolvedTheme } = useTheme ( ) ;
48+ const isDark = resolvedTheme === 'dark' ;
4649 const edgeData = data as SystemEdgeData | undefined ;
4750 const kind = edgeData ?. kind ?? 'request' ;
4851 const isActive = edgeData ?. isActive ?? false ;
@@ -54,6 +57,7 @@ export function LabelEdge({
5457 const status : SystemEdgeStatus = isActive ? 'active' : edgeData ?. status ?? 'normal' ;
5558 const kindStyle = EDGE_KIND_STYLES [ kind ] ;
5659 const stroke = edgeStatusStroke ( kind , status ) ;
60+ const labelStroke = edgeStatusStroke ( kind , status , isDark ) ;
5761 const shouldAnimate = ! prefersReduced && ( animated || isActive || kind === 'streaming' ) ;
5862
5963 // Separate parallel edges by applying a perpendicular offset
@@ -108,8 +112,8 @@ export function LabelEdge({
108112 position : 'absolute' ,
109113 transform : `translate(-50%, -50%) translate(${ labelX } px, ${ labelY } px)` ,
110114 pointerEvents : 'all' ,
111- borderColor : isActive || isHighlighted ? stroke : 'color-mix(in srgb, var(--text-primary) 12%, transparent)' ,
112- color : stroke ,
115+ borderColor : isActive || isHighlighted ? labelStroke : 'color-mix(in srgb, var(--text-primary) 12%, transparent)' ,
116+ color : labelStroke ,
113117 opacity : isDimmed ? 0.35 : 1 ,
114118 } }
115119 onMouseEnter = { ( ) => edgeData ?. onHover ?.( id ) }
0 commit comments