Skip to content

ThemeMode ​

Version Availability

This enum is available starting from v3.9.0

Enum defining the email template theme mode exposed through editor state.

typescript
enum ThemeMode {
  LIGHT = 'LIGHT',
  DARK = 'DARK'
}

Description ​

ThemeMode identifies whether the email template is currently rendered in light or dark mode. Use it with BaseApi.getEditorState() or BaseApi.onEditorStatePropUpdated() when extension UI should adapt to the editor theme.

Import ​

typescript
import { ThemeMode } from '@stripoinc/ui-editor-extensions';

Enum Values ​

ValueDescription
LIGHTThe email template is using the light theme
DARKThe email template is using the dark theme

Example ​

typescript
const {themeMode} = this.api.getEditorState();

if (themeMode === ThemeMode.DARK) {
  this.api.sendEvent('extensions.theme.dark-mode-active', {});
}

// Use this global API to change the email template theme
// StripoEditorApi.templateThemeModeApi.setTemplateThemeMode('DARK');