Theme

An interface for managing MindDrop's theme.

Hooks provide access to themes from inside React components. Unlike resources accessed using static methods, hooks will cause the component to rerender when the data changes.

Returns the theme's current appearance.

useAppearance(): ThemeAppearance

Returns the theme's current appearance setting.

useAppearance(): ThemeAppearanceSetting

Returns the theme's current appearance.

Theme.getAppearance(): ThemeAppearance

Sets the theme's current appearance. Dispatches a theme:appearance:set-value event.

Theme.setAppearance(core: Core, value: ThemeAppearance): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
value*ThemeAppearanceThe theme's current appearance.

Returns the theme's appearance setting.

Theme.getAppearanceSetting(): ThemeAppearanceSetting

Sets the theme's appearance setting. Dispatches a theme:appearance:set-setting event.

Theme.setAppearanceSetting(core: Core, value: ThemeAppearanceSetting): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
value*ThemeAppearanceSettingThe theme's appearance setting.

Adds theme specific event listeners. Equivalent to calling addEventListener directly on core, but provides more advanced type definitions.

Theme.addEventListener(core: Core, event: ThemeEvent, callback: EventListenerCallback): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
event*ThemeEventThe event type to listen for. See the theme events section below for available events.
callback*EventListenerCallbackThe callback fired when the event occurs. See the theme events section below for the data passed to the callback.

Removes theme specific event listeners. Equivalent to calling removeEventListener directly on core, but provides more advanced type definitions.

Themes.removeEventListener(core: Core, event: ThemeEvent, callback: EventListenerCallback): void
ArgumentTypeDescription
core*CoreA MindDrop core instance.
event*ThemeEventThe event type for which to remove the event listener.
callback*EventListenerCallbackThe callback of the event listener to remove.

See below the table for more details on the data passed by theme related events.

NameDataDescription
theme:appearance:set-valueThemeAppearanceDispatched when the theme appearance is changed.
theme:appearance:set-settingThemeAppearanceSettingDispatched when the theme appearance setting is changed.

Theme events are dispatched with one of the following types of data.

ThemeAppearance

The current theme appearance. See the Theme interface page for more details.

ThemeAppearanceSetting

The theme appearance setting. See the Theme interface page for more details.