/** * Read a CSS custom property value from :root. * Use this inside ECharts options / canvas drawing so colors track CSS variables * (e.g. --color-text-secondary) instead of being hard-coded. * * Stage 3 will add re-render-on-theme-change via a `key={theme}` on chart hosts. * * @example c('text-secondary') // → '#8b8ea8' under dark theme * @example c('chart-area-from') // → 'rgba(108, 99, 255, 0.25)' under dark */ export function c(token: string): string { if (typeof window === 'undefined') return ''; return getComputedStyle(document.documentElement) .getPropertyValue('--color-' + token) .trim(); }