Référence de l’API

Theme

Cette page API est actuellement disponible en anglais. Les signatures et identifiants restent identiques dans toutes les langues.

Theme is the shape of defaultTheme, exported by @univerjs/themes and @univerjs/presets. Start with a complete theme and override the tokens you need:

TypeScript
import type { Theme } from '@univerjs/themes'import { Univer } from '@univerjs/core'import { defaultTheme } from '@univerjs/themes'const theme: Theme = {  ...defaultTheme,  primary: {    ...defaultTheme.primary,    600: '#2563eb',  },}const univer = new Univer({ theme })

The theme includes color scales, semantic tokens, and component-specific values. Preserve the other keys when changing one group. For runtime switching, use univerAPI.setTheme(); plugin implementations should read the active theme through ThemeService.

Que pensez-vous de ce guide ?

© 2026 DreamNum Co., Ltd.