Skip to content

Function: useChartChrome()

useChartChrome(ref): ChartChrome

Resolve the chart chrome for ref’s element and keep it current as the theme changes.

Two triggers, matching the two ways AppKit’s stylesheet switches themes: an explicit .dark / .light class (watched with a MutationObserver on the document root, which is where hosts toggle it) and the OS preference that :root:not(.light) falls back to (watched with matchMedia). The resolved value is compared structurally before being stored, so an unrelated attribute change does not hand callers a new object and re-render every chart.

Returns LIGHT_CHART_CHROME on the first render - the effect that reads the real tokens runs after mount, by which point the chart itself is usually still long-polling its spec.

RefObject<Element | null>

ChartChrome