Themes and Dark Mode

Using Official Themes

@univerjs/themes exports defaultTheme (also available as blueTheme), darkBlueTheme, greenTheme, orangeTheme, purpleTheme, redTheme, and yellowTheme.

If no theme is passed, Univer falls back to defaultTheme.

Installing Theme Plugins

Preset Mode

In preset mode, import themes from @univerjs/presets:

TypeScript
// import { defaultTheme } from "@univerjs/presets";import { yellowTheme } from '@univerjs/presets'const { univer } = createUniver({  theme: yellowTheme,  // theme: defaultTheme,})

Plugin Mode

In plugin mode, themes are provided by @univerjs/themes. Install that package first.

Shell
pnpm add @univerjs/themes
TypeScript
import { yellowTheme } from '@univerjs/themes'// import { defaultTheme } from "@univerjs/themes";const univer = new Univer({  theme: yellowTheme,  // theme: defaultTheme,})

Customizing Themes

A theme is an object that conforms to the Theme interface. Start from defaultTheme, override the fields that need to change, and pass the result to Univer. The theme type reference documents how the default variables are defined.

TypeScript
import type { Theme } from '@univerjs/themes';import { defaultTheme } from '@univerjs/themes';export const customTheme: Theme = {  ...defaultTheme,  primary: {    ...defaultTheme.primary,    50: '#F5F3FF', 100: '#EDE9FE', 200: '#DDD6FE', 300: '#C4B5FD',    400: '#A78BFA', 500: '#8B5CF6', 600: '#7C3AED', 700: '#6D28D9',    800: '#5B21B6', 900: '#4C1D95',  },};
TypeScript
// Import your custom theme hereimport { customTheme } from './custom-theme'const univer = new Univer({  theme: customTheme,})

Theme Customizer

The theme customizer is a standalone tool for editing Univer theme tokens, previewing light and dark modes, and copying the resulting Theme JSON.

Dark Mode

Set darkMode to true to start Univer in dark mode.

TypeScript
new Univer({  darkMode: true,})

Facade API

The Facade API can also switch dark mode at runtime.

TypeScript
import { darkBlueTheme } from '@univerjs/themes'univerAPI.setTheme(darkBlueTheme)univerAPI.toggleDarkMode(true)const currentTheme = univerAPI.getCurrentTheme()console.log(univerAPI.isDarkMode(), currentTheme)univerAPI.toggleDarkMode(false)

How is this guide?

© 2026 DreamNum Co., Ltd.