33// ========================================
44// Line-style logo for Claude Code Workflow
55
6+ import { useEffect , useState } from 'react' ;
67import { cn } from '@/lib/utils' ;
78
89interface CCWLogoProps {
@@ -14,11 +15,54 @@ interface CCWLogoProps {
1415 showDot ?: boolean ;
1516}
1617
18+ /**
19+ * Hook to get reactive theme accent color
20+ */
21+ function useThemeAccentColor ( ) : string {
22+ const [ accentColor , setAccentColor ] = useState < string > ( ( ) => {
23+ if ( typeof document === 'undefined' ) return 'hsl(220, 60%, 65%)' ;
24+ const root = document . documentElement ;
25+ const accentValue = getComputedStyle ( root ) . getPropertyValue ( '--accent' ) . trim ( ) ;
26+ return accentValue ? `hsl(${ accentValue } )` : 'hsl(220, 60%, 65%)' ;
27+ } ) ;
28+
29+ useEffect ( ( ) => {
30+ const updateAccentColor = ( ) => {
31+ const root = document . documentElement ;
32+ const accentValue = getComputedStyle ( root ) . getPropertyValue ( '--accent' ) . trim ( ) ;
33+ setAccentColor ( accentValue ? `hsl(${ accentValue } )` : 'hsl(220, 60%, 65%)' ) ;
34+ } ;
35+
36+ // Initial update
37+ updateAccentColor ( ) ;
38+
39+ // Watch for theme changes via MutationObserver
40+ const observer = new MutationObserver ( ( mutations ) => {
41+ mutations . forEach ( ( mutation ) => {
42+ if ( mutation . attributeName === 'data-theme' ) {
43+ updateAccentColor ( ) ;
44+ }
45+ } ) ;
46+ } ) ;
47+
48+ observer . observe ( document . documentElement , {
49+ attributes : true ,
50+ attributeFilter : [ 'data-theme' ] ,
51+ } ) ;
52+
53+ return ( ) => observer . disconnect ( ) ;
54+ } , [ ] ) ;
55+
56+ return accentColor ;
57+ }
58+
1759/**
1860 * Line-style CCW logo component
1961 * Features three horizontal lines with a status dot that follows theme color
2062 */
2163export function CCWLogo ( { size = 24 , className, showDot = true } : CCWLogoProps ) {
64+ const accentColor = useThemeAccentColor ( ) ;
65+
2266 return (
2367 < svg
2468 width = { size }
@@ -27,7 +71,7 @@ export function CCWLogo({ size = 24, className, showDot = true }: CCWLogoProps)
2771 fill = "none"
2872 xmlns = "http://www.w3.org/2000/svg"
2973 className = { cn ( 'ccw-logo' , className ) }
30- style = { { color : 'hsl(var(--accent))' } }
74+ style = { { color : accentColor } }
3175 aria-label = "Claude Code Workflow"
3276 >
3377 { /* Three horizontal lines - line style */ }
0 commit comments