theme — Theme reading

Read Emberly's current theme to adapt your plugin interface.

Table of content
  1. Main method
  2. Limits

Capability: theme · Available in: workspace and live preview.

Main method

await this.theme.getTheme() returns a snapshot of the host theme, including its palette.

const theme = await this.theme.getTheme();
const isDark = theme.palette.mode === 'dark';

Limits

Theme reading is supported. Theme change subscriptions and theme overrides are not implemented. Reading the theme does not grant permission to render a UI; request ui separately when needed.