@@ -77,19 +77,37 @@ function useChartColors() {
7777 const updateColors = ( ) => {
7878 const root = document . documentElement ;
7979 const computedStyle = getComputedStyle ( root ) ;
80+ const currentTheme = root . getAttribute ( 'data-theme' ) || 'light' ;
81+
82+ // Theme-aware fallback colors
83+ const fallbackColors = currentTheme === 'dark'
84+ ? {
85+ primary : '#3b82f6' ,
86+ textMuted : '#94a3b8' ,
87+ border : '#334155' ,
88+ surface : '#0f172a' ,
89+ surfaceBorder : '#334155' ,
90+ }
91+ : {
92+ primary : '#3b82f6' ,
93+ textMuted : '#6b7280' ,
94+ border : '#e5e7eb' ,
95+ surface : '#ffffff' ,
96+ surfaceBorder : '#e5e7eb' ,
97+ } ;
8098
8199 setColors ( {
82100 primary :
83- computedStyle . getPropertyValue ( '--color-primary' ) . trim ( ) || '#3b82f6' ,
101+ computedStyle . getPropertyValue ( '--color-primary' ) . trim ( ) || fallbackColors . primary ,
84102 textMuted :
85103 computedStyle . getPropertyValue ( '--color-text-muted' ) . trim ( ) ||
86- '#9ca3af' ,
104+ fallbackColors . textMuted ,
87105 border :
88- computedStyle . getPropertyValue ( '--color-border' ) . trim ( ) || '#374151' ,
106+ computedStyle . getPropertyValue ( '--color-border' ) . trim ( ) || fallbackColors . border ,
89107 surface :
90- computedStyle . getPropertyValue ( '--color-surface' ) . trim ( ) || '#1f2937' ,
108+ computedStyle . getPropertyValue ( '--color-surface' ) . trim ( ) || fallbackColors . surface ,
91109 surfaceBorder :
92- computedStyle . getPropertyValue ( '--color-border' ) . trim ( ) || '#374151' ,
110+ computedStyle . getPropertyValue ( '--color-border' ) . trim ( ) || fallbackColors . surfaceBorder ,
93111 } ) ;
94112 } ;
95113
0 commit comments