@mocanvas/editor · function

useThemeCssVars

declare function useThemeCssVars(editor: Editor): CSSProperties

The theme's custom properties for an editor, tracked reactively — swapping a theme or flipping to dark restamps the container without anything being invalidated by hand.

Takes the editor rather than reading it from context, because the element that carries the variables is the canvas container itself: the hook runs above the provider that would supply it. The theme manager is read defensively for the same reason useColorMode does — a stand-in editor in a chrome test has no theme at all.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.