Features
Libraries
The editor theme contract, its default built on the design tokens, and the provider that keeps it in step with light and dark mode.
editor-theme is a library the editor surfaces read their colours from; it draws nothing of its own, so it
has no preview. Document Editor installs it.
Installation#
bash
pnpm dlx shadcn@latest add @zui/editor-themeUsage#
tsx
import { EditorThemeProvider, defaultEditorTheme, extendTheme } from '@/components/editor/shared/theme';tsx
const theme = extendTheme(defaultEditorTheme, { light: { code: { shiki: 'github-light' } } });
<EditorThemeProvider theme={theme}>
<Viewer doc={content} />
</EditorThemeProvider>;EditorThemeProvider follows next-themes' resolved theme into light or dark mode, unless forcedMode fixes
one. A theme holds a light and a dark variant, each naming the callout palettes, the code, diagram and
formula themes. extendTheme returns a copy of a theme with the overrides merged in, and useEditorTheme()
reads the theme, the mode and the variant a surface is drawn in; outside any provider it reads the default
theme in light mode.